[antlr-interest] specifying actions in v3
Terence Parr
parrt at cs.usfca.edu
Fri Nov 18 11:42:39 PST 2005
hi. I've updated the Nov 18th entry to have more Stringtemplate
integration stuff and to include information on including header
actions, parser/lexer instance actions, rule init actions etc...
http://www.antlr.org/blog/antlr3/rewrite.tml
Further, it discusses overriding codegen templates easily. :) For
example, to override how tokens are matched, just add this to the
bottom of the grammar:
codegen {
/** Override how tokens are matched to print out tracing info */
tokenRef(token,label,elementIndex) ::= <<
System.out.println("about to match token <token>");
<super.tokenRef(...)> <! do normal behavior !>
>>
}
All that w/o recompiling antlr or anything complicated.
I think that something like this will be cool.
Ter
More information about the antlr-interest
mailing list