[antlr-interest] cant find tokenRefBangTrack

Jim Idle jimi at temporal-wave.com
Mon Feb 18 12:58:47 PST 2008


Yes, for the short term, this is what you get. Ter has a plan to stop
this happening as it is very annoying.

 

Jim

 

 

 

From: Brent Yates [mailto:brent.yates at gmail.com] 
Sent: Monday, February 18, 2008 11:16 AM
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] cant find tokenRefBangTrack

 

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
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.



 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080218/029ffff8/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Jim Idle.vcf
Type: text/x-vcard
Size: 1863 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080218/029ffff8/attachment-0001.vcf 


More information about the antlr-interest mailing list