[antlr-interest] Non-determinism (again :-(

Robert Colquhoun rjc at trump.net.au
Fri Apr 4 01:45:58 PST 2003


Hello,

At 04:19 PM 3/04/2003 +0100, Anthony Youngman wrote:
>You can see I've tried to force statement_list into a node on its own ...
>
>and my treeparser rules ...
>
>loopst
>         : #("LOOP" {System.out.println("LABL LP1");} statement_list 
> "REPEAT" {System.out.println("GOTO LP1");} )
>         ;
>
>statement_line : ( ( statement)+ ) ;
>
>statement_list : ( (statement_line )+ ) ;

The above is a bit weird, how will it know when the 'statement_line' rule 
ends and a new 'statement_line' rule should be attempted to be matched in 
the 'statement_list' rule?

Either statement_line should be made into a tree rather than list of 
statements or the statement_list rule should just consist of '(statement)+'.

PS Yesterday you mentioned that at the end of all this, you would write up 
an example grammar....have you looked in the examples directory there is a 
'tinybasic' grammar which looks very similar to what you appear to be 
proposing.

  - Robert



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list