[antlr-interest] How to do abbreviation
Micheal J
open.zone at virgin.net
Sat May 12 03:12:10 PDT 2007
Hi,
> Hi,
>
> Is there a way to parse abbreviated key words using ANTLR?
> For example, I would like to recognize "ex 1" as "example 1".
>
A. Using tokens:
grammar AbbeviatedKeywordsLanguage;
tokens
{
EX_AMPLE = 'ex';
EXAMPLE = 'example';
}
command: example INT;
example: EX_AMPLE | EXAMPLE;
....
....
B. Using rules (can get messy and expect conflicts with IDENT rule):
EXAMPLE: 'ex' ( 'ample' )?;
Micheal
-----------------------
The best way to contact me is via the list/forum. My time is very limited.
More information about the antlr-interest
mailing list