[antlr-interest] Error in number recognition
Pierre Attar
pat at tireme.fr
Fri Mar 7 04:16:50 PST 2008
Hi,
I hav a problem with number recognition. I use the following reduced
grammar for recognizing sentences such as tensor[1,char[x],char[y]].
My problem ? When the DiacriticalNumber is commented, everything goes
well ; when it is active, antlr complains (even if it is not formally
used in this reduced debugging grammar).
It seems that I have a problem with the rule but I do not understand
which one.
grammar mff;
m : e=expression ;
expression : (r=atomOp | r=tensorOp ) ;
atomOp : (r=charact);
charact : 'char[' String ']';
tensorOp : 'tensor[' Number ',' expression (',' expression
)+ ']' ;
//DiacriticalNumber : ('0'..'9')+ ',' ('0'..'9')+ ','
('0'..'9')+ ',' ('0'..'9')+ ',' ('0'..'9')+;
StringNumber
: ('\n0022'|'"') Number ('\n0022'|'"');
Number : ('0'..'9')+;
Decimal : ('0'..'9')+ '.' ('0'..'9')+;
String : Letter+;
CompleteString : (Letter | '0'..'9')+;
fragment Letter : 'a'..'z'|'A'..'Z';
Thanks a lot for help, Pierre
More information about the antlr-interest
mailing list