Hi everyone,
I created a simple expression grammar in a .g file. I checked it with
Antlrworks to see that there were no errors in the grammar. The grammar is the
following:
****************
grammar Expression;
prog : exp
;
exp : '(' exp ')' exp_t
| atomic_expr exp_t
| '!' atomic_expr exp_t
;
exp_t : '->' exp exp_t
| '&&' exp exp_t
| '||' exp exp_t
|
;
atomic_expr
: ID
| 'Unavailable' '(' GEN ')'
| 'Powers' '(' GEN ',' ID ')'
| 'OnlyAvailable' '(' GEN ')'
;
ID : ('a'..'z'|'A'..'Z')('a'..'z'|'A'..'Z'|'0'..'9')*
;
NUM : ('0'..'9')+
;
GEN : 'X_L1'
| 'X_L2'
| 'X_R1'
;
WS : (' '|'\t')+ {skip();};
********************
When I run "java antlr.Tool Expression.g" I get the following
ANTLR Parser Generator Version 2.7.7 (20060906) 1989-2005
Expression.g:1:1: unexpected token: grammar
error: Token stream error reading grammar(s):
Expression.g:11:13: expecting ''', found '>'
Expression.g:1:1: rule grammar trapped:
Expression.g:1:1: unexpected token: grammar
TokenStreamException: expecting ''', found '>'
Can anyone help me out?
Thanks.
Rajesh
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.