[antlr-interest] How to keep the embedded Java code to minimum.

Gerald Rosenberg gerald at certiv.net
Thu Mar 27 09:52:36 PDT 2008


One way I find convenient is to create a helper object and set it to 
the parser.  Most actions are then just calls to helper methods.

...
ParserHelper helper = new ParserHelper();
XXXParser parser = new new XXXParser(tokens);
parser.setHelper(helper);
...

At 08:59 AM 3/27/2008, you wrote:
>All,
>
>I have a general question for  ANTLR folks.  How do you keep the
>embedded java (or other) code in your grammar to a minimum to preserve
>readability of the grammar?
>
>Greg



More information about the antlr-interest mailing list