[antlr-interest] Sample automatic visitor

Scott Stanchfield scott at javadude.com
Thu Sep 8 15:23:03 PDT 2011


Just to be pedantic (as I teach Design Patterns at JHU)... using the word
"visitor" here isn't quite correct (per GoF), and is apt to cause confusion
for people who are familiar with the GoF visitor pattern.

The TListener and its implementations are actually closer to the role of
"visitor" per GoF.

I'd recommend renaming what you're calling the "visitor" to "walker" or
something similar, and keep the TListener.

What you're doing here is much simpler to understand than the GoF visitor
pattern and more direct anyway...
-- Scott

----------------------------------------
Scott Stanchfield
http://javadude.com


On Thu, Sep 8, 2011 at 5:32 PM, Terence Parr <parrt at cs.usfca.edu> wrote:

> Hi, I have a prototype working for the automatic parse tree construction
> and automatic visitor generation, which I've described here:
>
>
> http://www.antlr.org/wiki/display/~admin/2011/09/08/Sample+v4+generated+visitor
>
> Feedback is very welcome, and now is a good time to speak up ;)
>
> It makes me a bit nervous to generate 2 extra files from every grammar, but
> I'm guessing it will be one of the most popular ways to use ANTLR. My goal
> is to make ANTLR very easy to use out-of-the-box while still allowing
> performance minded experts to get what they need.
>
> Ter
>
> 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