[antlr-interest] Generating initializers and headers
nik9000 at gmail.com
Tue Jan 29 05:02:15 PST 2008
I've been puzzling over this for a few days, and haven't thought of anything
useful, so I figured I'd ask the group.
I'm looking to generate C code from antlr/stringtemplate. I'd like to
generate methods in a .c file, method signatures in a .h file, and probably
some sort of initialization method in the .c file. My problem is that any
part of the AST could generate code in any of those 3 places. What is the
normal way to handle this?
I have been using an OutputStream that can recognize escape sequences to
change which file its writing to. This lets me write 1 template per
construction of the form
methodDef(name, stuff...) ::= <<
blah blah blah
extern blah blah blah
metadata goes here
This gets the job done, but doesn't feel all that elegant so its probably
not the right way to do it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest