[antlr-interest] A basic question!

Jim Idle jimi at temporal-wave.com
Wed Jun 20 12:49:00 PDT 2007


$expr returns a reference to the rule, so if you want the text you
should try $expr.text (Java target). See examples and the book J.

 

Jim 

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of ali azimi
Sent: Wednesday, June 20, 2007 12:17 PM
To: antlr-interest
Subject: [antlr-interest] A basic question!

 

Hello,

 

I know this question is very basic for all of you. But I really
appreciate if you tell me what is it that I do wrong. 

 

I get an error message when I try to generate Lexer and Parser from a
grammar which includes the following:

 

prog: stat+ ;

stat: expr NEWLINE {System.out.println($expr.value);}

| ID '=' expr NEWLINE{memory.put($ID.text, new Integer($expr.value));}

| NEWLINE

;

 

The error message is as follows:

 

Check Grammer failed:

(116): C:\Documents and ...|Expr.g:11:20: unknown attribute for rule
expr: value 

Consult the console for more information.

(116): C:\Documents and ...|Expr.g:12:20: unknown attribute for rule
expr: value 

Consult the console for more information.

 

Thank you in advance for any advice.

 

Al

  

________________________________

Be a better Heartthrob. Get better relationship answers
<http://us.rd.yahoo.com/evt=48255/*http:/answers.yahoo.com/dir/_ylc=X3oD
MTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklf
MzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545433> from
someone who knows.
Yahoo! Answers - Check it out. 

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


More information about the antlr-interest mailing list