C– specification (Version 2)
The specification is available as DVI, PostScript, or PDF.
The Quick C– compiler and interpreter
The C– compiler under most active development is Quick C–. It includes an interpreter with run-time system and a native-code compiler that is more or less ready for prime time. The native-code compiler supports only the Intel x86 architectures; support for several other architectures, including PowerPC for Mac OS X, remains to be completed.
You can download the most recent tarball or read about the full capabilities of our rsync server, which includes browsing the source code. If you don’t like building things from source, you can also download a x86 Linux glibc6 binary.
Front ends that emit C–
Paul Govereau has written a demonstration front end for Tiger.
We have adapted Fraser and Hanson’s lcc compiler to emit C–, except that this compiler cannot compile varargs functions. (Calls to varargs functions are OK.) This work is not on our web site, but we are happy to share it with interested researchers.
Matthew Fluet has adapted the MLton optimizing compiler to emit C–, but as of April 2005, the MLton front end triggers a number of C– compiler bugs, so this front end is not yet usable.
Lua-ML is an interpreter for version 2.5 of the Lua programming language. We use Lua-ML to configure and script the Quick C– compiler. You may want to read papers about support for embedding and separate compilation.
Mk is Andrew Hume’s reimplementation of make. Mk is recommended by Stu Feldman, who created make. Mk has evolved through many systems from Bell Labs. Mk does not try to do everything but instead provides small but coherent set of features, including especially good integration with the shell. We use it to build Quick C–, and we’re very happy.
The C code for Mk is extracted from the Plan 9 source distribution and comes with an Open Source License. Requirements for compilation are a C compiler and Make. The documentation includes a PDF file about Mk, and a Unix man page.
When an Objective Caml bytecode program (prior version 3.07) dies with an uncaught exception, it can leave a stack trace for debugging. The stack trace mentions source code positions in modules, where each position is a character-offset from the beginning of the file. The OCamlError tools reads such a stack trace and annotates it with more readable (file, line, column) source code positions. It also honors CPP line directives that are useful when source code is created by tools like OCamlYacc or other preprocessors.
Starting with OCaml 3.07, stack traces refer to source code positions by file, line, and column directly. OCamlError is obsolete for such programs.
Requirements for compilation: Objective Caml 3.*, GNU Make, Perl. The source code is a literate program and comes with documentation in HTML format and a Unix-style manual page.
Burg is somewhat analagous to Yacc for tree grammars as opposed to string grammars. Like `Yacc’, Burg can stand for an idea or a family of tools as well as a particular tool. A typical use is to use Burg to map an intermediate-code tree to a sequence of machine instructions. OCamlBurg is member of the Burg family and emits Objective Caml code. OCamlBurg is inspired by IBurg from Fraser, Hanson, and Proebsting. Their paper about IBurg includes an introduction to code generation with IBurg.
Requirements for compilation: Objective Caml 3.*, GNU Make, Perl. The source code is a literate program and comes with documentation in HTML format, a Unix-style manual page, and examples.
- Fermin Reig‘s cmmc is implemented in Standard ML on top of the MLRISC code generator. It emits assembly code for the Alpha, Sparc, and X86. It implements an obsolete version of C– and is no longer maintained.
- The Trampoline C– Compiler by Sergei Egorov, which seems to have disappeared from the Web. The Trampoline C– compiler implements the obsolete May, 1999 specification and compiles to C. The author says: it is slow, requires too much memory, and generates slow C code. But, from the other hand, it implements almost all of original C– specification (including runtime interface), the generated code is readable, portable, and hopefully correct.
- The Oregon C-- compiler was the first prototype implementation of C--, also on top of MLRISC. It has been honorably retired.