[antlr-interest] tree rewrite - tokenRefRootTrack.st?

raj sisodia raj.sisodia at impetus.co.in
Sun Nov 19 01:00:16 PST 2006


Hi,

 

Looks like you have written this rule wrong

 

eRhs

      :     NUM PRED^ conditions(SEMI!) -> ^(ASSERT NUM ^(PRED

conditions))

      |     expr(PRED^ conditions)?(SEMI!) -> ^(ASSERT expr

^(PRED conditions?))

 

 

Thee shall not mix operators and rewrite rules

 

If you remove the operators and write the rule like this, your grammar would
compile and work fine.

 

eRhs

      :     NUM PRED conditions(SEMI) -> ^(ASSERT NUM ^(PRED conditions))

      |     expr(PRED conditions)?(SEMI) -> ^(ASSERT expr ^(PRED
conditions?))

      ;

 

Hoping that helps,

Raj Singh Sisodia

 

---------------------------------------------------------------------------

 

Hi,

On running the grammar below with antlr3.0-b5, I get

the errors:

 

>java -classpath ..\..\lib\antlr-2.7.7.jar;..\..

\lib\antlr-3.0b5.jar;..\..\lib\stringtemplate-3.0.jar;.

org.antlr.Tool SLang

.g

ANTLR Parser Generator  Version 3.0b5 (November 15,

2006)  1989-2006

error(10):  internal error: SLang.g :

java.lang.IllegalArgumentException: Ca

n't find template tokenRefRootTrack.st

 

---------------------------------------------------------------------------

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061119/d83732b6/attachment.html 


More information about the antlr-interest mailing list