[antlr-interest] Ambiguous parse tree generated

Sam Harwell sam at tunnelvisionlabs.com
Tue Oct 30 16:07:15 PDT 2012


In V3, a rewrite with multiple root operators behaves like individual rules in v4's parse trees. While the nodes in an AST produced by a V3 rule can have a complicated shape, the node created for a V4 rule is always a single node for the rule with a flat list of children (rule contexts and terminals) in the order they were parsed. Rule decomposition is the way to give your trees the shape you want, and really shouldn't cause a performance problem in v4.

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Gerald Rosenberg
Sent: Tuesday, October 30, 2012 3:04 PM
To: jimi at temporal-wave.com
Cc: ANTLR-Interest Interest
Subject: Re: [antlr-interest] Ambiguous parse tree generated

Yes, and that is the work around I am using now.  Sorry if I was not clear.

Resorting to rule decomposition unfortunately greatly increases the number of enter/exits and the depth of what was, in v3, AST rewrites.  
Was hoping I was missing some way to mark or label the rule elements to remove the ambiguity.




More information about the antlr-interest mailing list