[antlr-interest] problem with nondeterminism

Wirth. Michael M.Wirth at seeburger.de
Thu May 8 03:21:40 PDT 2003


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/ 




More information about the antlr-interest mailing list