Hi All,
The section "Ambiguities and Non determinisms" of the book "The definitive
ANTLR guide" talks about the ambiguities in lexer rules, but I am not sure
how to resolve them.
Consider a following grammar which assigns a value to an ID. The ID can
either be VERSION or COUNT while its value can be anything:
-----------------------------------------------
grammar sample_parser;
requestline : ver EQUAL SPECIAL_STRING ;
/* Tokens */
ver:('VERSION'| 'V') {}
| ('COUNT' | 'C') {} ;
SPECIAL_STRING:(CHAR)+ ;
WHITESPACE: ' ';
NEWLINE: ('\r')? '\n';
EQUAL: '=';
fragment
CHAR: (('a'..'z')|('A'..'Z'));
-----------------------------------------------
If the input is given as
VERSION=FIRST
Then it works, but if following input is given
VERSION=VERSION
Then I get an error (MissingTokenException after the "=").
How can this ambiguity be resolved ?
Thanks in advance.
Regards,
Achint
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address