[antlr-interest] newbie question about nondeterminism between keywords and identifiers
David Guy
dguy at bea.com
Thu Feb 1 08:58:22 PST 2007
I have a typical lexer IDENT rule:
IDENT
options {testLiterals=true;}
: ('_'|'a'..'z')('_'|'a'..'z'|'0'..'9')*
;
The language has some built in types. For example (from lexer):
TYPE_DATE :"date";
// declares type
COLON : ':';
In my parser, if I have a rule like:
decl:
IDENT COLON TYPE_DATE
;
I cannot parse "mydate : date" or "date_foo : date". The first example
gets IDENT than unexpected TYPE_DATE and the second case gets unexpected
TYPE_DATE.
I know this is very basic stuff, but I have looked at sample Java
grammars and don't see anything different and of course in Java you can
say
int myint; int int_xxx;
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070201/a95ee6a5/attachment-0001.html
More information about the antlr-interest
mailing list