[antlr-interest] Intermediate code generation...

Rob Greene robgreene at gmail.com
Thu Nov 24 10:31:02 PST 2005


I'm curious what strategies people use when generating intermediate
code from an ANTLR grammar/language.

I'm putzing with a BASIC (that RBASIC sample I needed help with
earlier) compiler which I would like to have multiple target CPUs
coming out of the backend (principally 6502, 65c02, and 65816, but
potentially for embedded devices too).

The general process was to be source code ==compile=> intermediate
code ==optimize=> intermediate code ==generate=> target CPU assembly
==assemble=> executable. I think that's fairly standard...

What has me stymied a bit is that ANTLR to intermediate code
generation step. I'm pretty much looking at a separate Java
application to take the generated AST and start writing code. It feels
brute-force, but I'm not certain there's really a better method. I see
a lot of people dump stuff into the TreeParser, but seems to add
confusion rather than clarity.

Thanks!
-Rob


More information about the antlr-interest mailing list