[antlr-interest] LPG WAS Retaining comments

Brent Yates brent.yates at gmail.com
Thu Mar 13 11:47:55 PDT 2008


I will just add my two cents worth just so Andy doesn't feel he is alone.  I
am not a parsing expert, just a hobbyist.  I have played with parser
generators for the last several years (everything from VisualParser++, GOLD,
and Antlr2).  As a noob, "seeing" the tree generated from initial grammar
experiments is very helpful.  I tells you that you are going it the right
direction.  It gives immediate positive and negative feedback for a beginner
whose skills are not yet to the point where he can "see the matrix".  One of
the first test programs I wrote when playing with Antlr3 was to take the
generated AST and write out a DOT script to visualize the tree just like
AntlrWorks does.  Of course the default "tree" from Antrl is flat which is
not useful at all for visualization.  I knew that flat was the default from
my time with Antlr2 so I next started adding rewrite rules.  I don't
remember how long I fought with Antlr2 as that was years ago, but it was
tramatic enough that I clearly remember wondering what was going on.  If the
output was not flat my progression would have been quicker.  I would not
have gotten the final tree that I wanted, but I would have gotten positive
feedback that I was producing a tree.  The logical progression would be to
tweek the tree into a better form.

As a beginner when you see something that doesn't even look close to what
you expect, you can easily spend a lot of time checking in the wrong places
for a solution.  I believe that giving too much information (i.e., the parse
tree) will lead to a quicker understanding of why you need to carefully plan
an AST for post generation processing.  Giving too little (flat tree) tends
to make one confused about what to do next.

Regards,

Brent Yates
brent.yates at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080313/a8231556/attachment.html 


More information about the antlr-interest mailing list