[antlr-interest] ANTLR 3.0 tree construction proposal
Terence Parr
parrt at cs.usfca.edu
Mon Jan 31 13:56:36 PST 2005
On Jan 31, 2005, at 1:41 PM, Martin Probst wrote:
> Hi,
>
>> What is my point? Tree construction syntax is already a barrier to
>> overcome to reading Antlr grammars.
>
> It might be too late or just insignificant and certainly somewhat
> offtopic but here is my users perspective: I find the ANTLR style of
> defining tree construction _very_ strange. IMHO it's close to code
> obfuscation with all these ^, !, :, =, # and [].
Well, the ^ and ! should be very clear, right? You are merely
specifying what is a subtree root and what is to be ignored. It's the
interaction with #(...) etc... in 2.x that is confusing I think.
> I would really prefer it if ANTLR would stick to some clear keywords
> and
> maybe find a way of distinguishing ANTLR actions (e.g. where you do
> $setType and similar things) and actions in the target language.
I'm trying to avoid having any special stuff in actions. :) The
rewrites help a lot. I don't anticipate needing actions to build trees
at the moment.
> The readability of tree construction syntax is really very poor at the
> moment.
Thanks for the feedback!
Do you think the new rewrite stuff would be easy to understand? Some of
surely would. For example, build a flat tree with elements reordered:
r : A B => B A ;
Will that help do you think or is it just as bad? I really want to get
this right!
What are your thoughts on Loring's counter-proposal?
Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
More information about the antlr-interest
mailing list