[antlr-interest] Constants in AST
jaluber at gmx.de
Mon Jul 28 12:59:11 PDT 2008
Brisard, Fred D schrieb:
> Is there a simple way to insert constants into an AST? It seems like
> the operators require anything being inserted into an AST node to be
> either a lexical token or a parser rule.
> I just want to put a simple constant in a node so that I can search on
> it later. Maybe that’s a bad idea so it isn’t supported.
> I did notice that I could define fragment lexical tokens that could be
> Thanks for any clarification or suggestions.
> Regards, Fred
Did you try imaginary tokens? Those are defined in the tokens section
And they can be inserted like real tokens anywhere you need them.
More information about the antlr-interest