[antlr-interest] cant find tokenRefBangTrack

Ian Moor iwm at doc.ic.ac.uk
Mon Feb 18 10:49:54 PST 2008


I am constructing a grammar for a very small subset of C and 
the section for the if statement, which is similar to the example in the book 
generates an internal error :

 error(10):  internal error: Pico.g : java.lang.IllegalArgumentException: Can't find template tokenRefBangTrack.st

the code is 
 if_stmt    :  IF LPAREN! cond=expr RPAREN! stmt=statement      
              ( ( (ELSE) =>   ELSE) elsestmt = statement -> 
                  ^( IFELSE  $cond   $stmt $elsestmt )
               | /* empty no else */  ->
                  ^( IF $cond $stmt ) 
                  
              )             ;

Without the rewrite rules the grammar compiles.
Is there another way to do this ?
 Ian W Moor                    Department of Computing,
iwm at doc.ic.ac.uk           Imperial College.
                                    180 Queensgate
                                     London SW7 2AZ UK.
 
  



More information about the antlr-interest mailing list