[antlr-interest] problem with nondeterminism
Michael Wirth
M.Wirth at seeburger.de
Sat May 10 12:02:01 PDT 2003
Thanks, now I can see the problem too.
Am Samstag, 10. Mai 2003 00:10 schrieben Sie:
> When antlr analyzes (unit)*, it sees that PROGRAM javaconstruct could be
> parsed two ways. It's a lot like the if/else ambiguity. You can turn off
> the warning with the warnWhenFollowAmbig=false option. See the docs about
> it.
>
> Monty
>
> -----Original Message-----
> From: Wirth. Michael
> To: antlr-interest at yahoogroups.com
> Sent: 5/8/2003 3:21 AM
> Subject: [antlr-interest] problem with nondeterminism
>
> Hello,
>
> here is the code.
>
> -----------------------------------------
> start: (unit)* ;
>
> unit : program
>
> | procedure
> | globaljavastart
>
> ;
>
> program : PROGRAM (statement)* ;
>
> statement :
> javaconstruct
> // | "if" ...
> // | "while" ...
> // ...
> ;
>
> javaconstruct :
> javastart
>
> | globaljavastart ;
>
> globaljavastart :
> GLOBALJAVASTART GLOBALJAVAEND ;
>
> javastart :
> JAVASTART JAVAEND ;
>
> procedure :
> PROCEDURE (statement)* ;
> -----------------------------------------
>
> antlr generates the folloing warnings
> (for the rule "program" and "procedure")
> warning:nondeterminism upon
> k==1:GLOBALJAVASTART
> between alt 1 and exit branch of block
> warning:nondeterminism upon
> k==1:GLOBALJAVASTART
> between alt 1 and exit branch of block
>
> I think the problem is that the rule "globaljavastart"
> can be used in a statement and in a unit.
> Can I define the grammar in an other way?
> Or can I ignore these warnings?
>
> I hope someone can help me, because I need this
> in my diploma thesis.
>
> Greetings,
> Michael
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list