Tock (translator from occam to C from Kent) is a Haskell-based compiler for occam and related languages.

Current frontends:

Current backends:

It's written in Haskell, making use of the Parsec parser combinator library and generic tree transformation passes. It aims to provide C-like performance for straightline code.

For more details on Tock, see Adam's fringe presentation from CPA2007:

Tock is currently experimental and under development; if you're after a stable occam-pi implementation then please see KRoC or the Transterpreter.

Getting Tock

The source code is currently managed using Darcs. You can browse it with a web browser here:

To download a copy of the source to play with, install Darcs, then do darcs get --partial; this will give you a tock directory containing the source code.

Compiling Tock

Tock itself needs GHC version 6.6 or later. If you're on Debian, then install the packages ghc6 ghc6-libsrc ghc6-prof libghc6-mtl-dev haddock.

To compile Tock itself, type make.

Tock's C backend needs GCC 3 or later, and a post-2007-04-23 KRoC installation. You can say make testcases/commstime-mini to compile one of the testcases.

Working on Tock

Tock is designed to make it straightforward to experiment with modifications to the compiler -- for example, adding new backends, or testing out new language features or optimisations. If you're interested in working on Tock yourself, then please join the tock-discuss mailing list:

The code is documented inline using Haddock syntax; install Haddock and type make haddock to create HTML documentation in the doc directory.

Tock (last edited 2008-11-20 13:17:07 by ats)