[antlr-interest] Example code with multiple AST passes?
Bryan Ewbank
ewbank at gmail.com
Mon Jun 20 12:25:09 PDT 2005
True, it's not elegant, but I can *always* define actions for each
production (using the same name), and have them do the same thing.
Thank you for the warning about disabling default tree construction;
hadn't thought about that yet and it's always better to learn from the
mistakes, er, experience of others.
I too would like to see true inheritance - even restricted to just
"redefine tail actions" to avoid lookahead set weirdness - so that I
don't have to do the same thing over and over.
On 6/20/05, Don Caton <dcaton at shorelinesoftware.com> wrote:
> It works, but it's not what I'd call an elegant solution. You need code in
> each action to make sure that the action only occurs in the desired pass,
> and if the rule has default tree construction turned off, you can't forget
> to return a tree in an action, even if you don't have anything else to do,
> ...
> This will crash very nicely during an pass other than #1 because no tree is
> returned. It's a pain when adding new passes.
More information about the antlr-interest
mailing list