[antlr-interest] Ambiguities in ANTLR's web Java grammar

Jos A. Horsmeier j.a.horsmeier at wanadoo.nl
Thu Oct 25 07:31:35 PDT 2007


-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Cristian Peraferrer
Sent: Thursday, October 25, 2007 4:17 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Ambiguities in ANTLR's web Java grammar

> I've found that the Java.g grammar file, doesn't work, as it has a 
> couple of ambiguities, starting from the basic "if-else" statements.

> My question is, for example, how it can be the "if-else" ambiguity 
> fixed? 

> Please I need some help on this, so anyways the Java grammar posted in 
> the web needs to be fixed somehow.

Those 'dangling' else constructs are ambiguous constructs in the grammar
but as long as the parser prefers a 'shift' over a 'reduce' everything is
fine and the 'else' will be associated with the innermost 'if-then'.

kind regards,

Jos




More information about the antlr-interest mailing list