[LLVMdev] ANTLR+LLVM example for simple C

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


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:


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!

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


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

More information about the llvm-dev mailing list