[antlr-interest] Approach to Multiple Passes using Tree Grammars without Filters (C#)?
Jim Idle
jimi at temporal-wave.com
Thu Jul 30 12:54:09 PDT 2009
I create an interface which handles all information from all rules
then create the separate classes implementing that interface. The tree
walker then calls against the interface and the driver program
installs the relevant class. This works very well and requires only
one copy of the tree grammar. If you rewrite the AST you may need two
grammars.
In general do not put anything but interface calls in actions.
Jim
On Jul 30, 2009, at 8:48 AM, Rob Dougan <rob_dougan at sympatico.ca> wrote:
> Antlr 3.1.3 does not have tree filters.
>
> Pass 1: lex/parse produces AST,
>
> I would like to do multi-pass processing on AST produced in first
> pass.
>
> Pass 2: Tree grammar A (AST): variable defs, build symbol table etc
> Pass 3: Tree grammar B (AST): static type checking etc.
> Pass 4: Tree grammar C (AST): execute
>
> If i do not have tree filters, do I have copy the tree grammar three
> times and modify the actions to accomplish the task?
>
> 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