[antlr-interest] Newbie: Token/Rule Difference [again..]
Trey Cool Shonuff
trey_shonuff at freemail.hu
Fri May 23 07:50:12 PDT 2008
Hi all,
I'm totally new to ANTLR and the last time I've really fiddled with language processing was back in college.
Please help me tell why the following two, similar grammars behave differently:
grammar G1;
q : WORD;
LETTER : ('a'..'z' | 'A'..'Z');
DIGIT : '0'..'9';
WORD : (DIGIT | LETTER)+;
--------
grammar G2;
q : (DIGIT | LETTER)+;
LETTER : ('a'..'z' | 'A'..'Z');
DIGIT : '0'..'9';
--------
I thought that these two were equivalent, however, G1 does not recognize the single-character sentence (throws MismatchedTokenException), while G2 does.
Can you tell me what the actual difference is?
Than You,
-Trevor.
_______________________________________________________
TÉRÍTÉSMENTES ÉRETTSÉGI UTÁNI SZAKKÉPZÉSEK!
2 év alatt akár 3 szakma!
EUROPASS, EBCL ÉS ECDL!
Jövő Európába - EFEB
http://ad.adverticum.net/b/cl,1,6022,259041,315847/click.prm
More information about the antlr-interest
mailing list