Available through Git (Atom feed of changes):
git clone http://offog.org/git/tock.git

About Tock

Tock (Translator from occam to C from Kent) is a compiler for languages that support lightweight concurrency and CSP-style message passing. It supports the following programming languages:

and has the following backends:

Tock is written in Haskell, using a nanopass architecture. Parsers are built using the Parsec parser-combinator system. Transformation nanopasses make use of generic programming techniques inspired by the Scrap Your Boilerplate library; Tock's generic programming library is available for general use as Alloy (for more details, see our Haskell Symposium paper). Usage-checking nanopasses can operate over the AST or a control flow graph; the Omega test is used to detect aliasing problems. Tock was written using test-driven development techniques; it has an extensive suite of unit tests and QuickCheck randomised tests, and passes the occam-pi conformance test suite.

The downside: Tock hasn't had any development since 2011, and needs some work to compile with modern versions of GHC. If you're interested then please let us know! Some components of Tock — for example, the occam parser, or the static checking algorithms — may be useful in other projects.


Adam Sampson wrote the initial version of Tock, supporting only occam-pi and the C backend. Neil Brown added the C++ and Haskell backends, support for his Rain language, extensive static checking features to detect concurrency errors at compile tile, and static analysis to support automatic use of MOBILE types (ownership types) to improve communication efficiency. Tock contains about 36,000 lines of Haskell; roughly 78% of this was written by Neil, and 22% by Adam.

The development of Tock was partially funded by EPSRC grants EP/P50029X/1 and EP/E049419/1.