[antlr-interest] cant find tokenRefBangTrack
parrt at cs.usfca.edu
Mon Feb 18 12:21:59 PST 2008
latest build emits a better error message I believe.
On Feb 18, 2008, at 11:16 AM, Brent Yates wrote:
> I have seen this before when mixing rewrite and !^ styles. I
> believe that if you remove the !'s it will work fine. Also, it may
> be a little clearer if you write the rule like this (unverified):
> if_stmt : (IF LPAREN cond=expr RPAREN stmt=statement -> ^(IF
> $cond $stmt) )
> (ELSE elsestmt = statement -> ^( IFELSE $cond
> $stmt $elsestmt ) )?
> Brent Yates
> On Feb 18, 2008 1:49 PM, Ian Moor <iwm at doc.ic.ac.uk> wrote:
> 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
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest