OCaml

Elkhound: A GLR Parser Generator

Friday, April 23rd, 2004

Thanks to David Wagner for a pointer to Elkhound, which is a GLR (Generalized LR) parser generator. It can generate parsers in C++ and OCaml, and includes Elsa, a grammar for C++.

CIL — Infrastructure for C Program Analysis and Transformation

Thursday, April 1st, 2004

CIL is a tool and library that inputs C source code and outputs simplified C that is more amenable to program analysis. It can generate CFGs and can perform several analyses and transformations out of the box. See here for more details; some notables follow:

  • points-to analysis
  • various buffer-overrun protection transformations
  • transform all subprograms to have at most one return statement
  • conversion of switch and continue constructs to simple branches
  • partial evaluation and constant folding
  • conversion of C code to three-address code

FrontC — C front-end for OCaml

Thursday, April 1st, 2004

FrontC is a C front-end written in OCaml. From the web page:

FrontC is an OCAML library providing a C parser and lexer. The result is a
syntactic tree easy to process with usual OCAML tree management.

It provides support for ANSI C syntax, old-C K&R style syntax and the standard
GNU CC attributes.

It provides also a C pretty printer as an example of use.

OCamlBurg

Thursday, April 1st, 2004

From Christian Lindig and the C–– group comes OCamlBurg, which is an implementation of a Burg-like code-generator-generator that produces OCaml code.

C––, portable assembly language

Thursday, April 1st, 2004

C–– is a “portable assembly language” — a target language for compiler backends that can compile into native code on several platforms. It is implemented in OCaml and appears sufficiently general to handle a wide range of language features: for example, all values are untyped strings of bits, multiple return values are possible, and tail call optimization is readily available. C–– also supports a run-time interface, so that one may use implementations of support code that are most suitable for a given language.

There are code generators for x86, PPC, IA-64, SPARC, MIPS, ARM, and Alpha. According to the web page, as of July 2003, the x86 backend is reasonably mature, whereas the rest are under development.

Thanks to Kent Hunter for the pointer.