[LLVMdev] ANTLR+LLVM example for simple C

Terence Parr parrt at cs.usfca.edu
Sat Dec 12 17:16:32 PST 2009


Howdy,

I just finished a book called Language Implementation Patterns but I ran out of room at 400 pages before I could squeeze in an LLVM example.  I left a link in the book to the ANTLR wiki so I can slap something together:

http://www.antlr.org/wiki/display/ANTLR3/LLVM

The code is good but the description was slapped together I'm afraid (i.e., don't take it as an example of the book quality. ha!).  The example is cool because the same generator can emit LLVM IR or C code depending on which templates we use.  It's simple enough that people might find it useful to learn about LLVM's IR and about source-to-source translators (I generate the text-based IR).

I'd welcome any feedback and corrections to the description or code. thanks!

Terence
PS	If you're curious about the book, here's the publishers link:

http://pragprog.com/titles/tpdsl/language-implementation-patterns

It's at the printer as we speak!  In stores by new years.





More information about the llvm-dev mailing list