[antlr-interest] Code Hooks

Jim Idle jimi at temporal-wave.com
Fri Aug 13 12:48:17 PDT 2010


Do this with source code control. I create a clean unadorned grammar (other
than if I have no choice but to have semantic action code) as the base point
for everything and always change that. Then I integrate (using perforce
terminology) to all my other specific use targets.

Generally, I do nothing in the parser but produce an AST and if feasible,
build a symbol table(s). Then I do everything using tree walking - I
recommend this approach generally and in many cases it is all you can do
because only multiple tree walks distinguish what you parsed (such as C++
for instance).

There are some applications where the info you want from the parser is
available as you go and trivial to gather, but personally I would still use
an AST walk because requirements have a habit of becoming more complicated
overtime.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Stanley Steel
> Sent: Friday, August 13, 2010 11:54 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Code Hooks
> 
> Is there a way to specify code hooks for @init and @after.  I would like
to
> keep my spec clean and not pollute it with code specific to a particular
usage.
> Does anybody else verify scope in the tree parser instead of the regular
> parser?
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list