[antlr-interest] Bison-> Antlr 3 help

Terence Parr parrt at cs.usfca.edu
Thu Oct 19 10:30:04 PDT 2006


On Oct 19, 2006, at 10:23 AM, Mike Aubury wrote:

> Yeah - I get things like  :
>
> 	OPEN_BRACKET ID CLOSE_BRACKET
> 	| OPEN_BRACKET SOMETHINGELSE CLOSE_BRACKET
>
> I know these can be rewritten as
> 	OPEN_BRACKET (ID|SOMETHINGELSE) CLOSE_BRACKET
> - but I thought thats what lookaheads are for...

It is.  What is SOMETHINGELSE?  Must include ID or there is no  
ambiguity.  Your error:

         fgl_v3.g:164:12: Decision can match input such as "NAMED  
OPEN_BRACKET"
using
         multiple alternatives: 4, 5
         As a result, alternative(s) 5 were disabled for that input

suggests a true ambiguity not a weakness in the parsing strategy.

> There are also ones where the tokens are way down in other others...
>
> (Also - as soon as you make one of these changes - you loose all the
> highlights...)

Rerun the grammar analysis then. ;)

Ter


More information about the antlr-interest mailing list