[LLVMdev] gerate LLVM IR from an AST output from ANTLR

Tim Northover t.p.northover at gmail.com
Thu Aug 15 07:25:35 PDT 2013


Hi Emily,

> So, in this tutorial, the LLVM IR generation code is embedded in the parser.

It's embedded in the AST classes, but the parser itself doesn't know
anything about it. It's still a two-stage process: create AST, then
generate code from it.

It looks like ANTLR would allow you to change the AST to one with
similar abilities, but I can see why you might not want to.

> or do I just walk the tree and generate the iR?

That seems like the only option to me. Nothing inside LLVM is going to
know about the intended semantics of your AST.

Cheers.

Tim.



More information about the llvm-dev mailing list