[antlr-interest] lexical nondeterminism between IDENT & LABEL
Monty Zukowski
monty at codetransform.com
Wed Nov 3 12:17:30 PST 2004
On Nov 3, 2004, at 9:49 AM, John D. Mitchell wrote:
>
>>>>>> "thoth2487" == thoth2487 <thoth2487 at libero.it> writes:
> [...]
>
>> Hi to all, I've a very simple language in which there are IDENTifiers
>> and
>> jump LABELs. An IDENTifier start with ('a'...'z')|('A'..'Z') and
>> continue
>> with ('a'...'z')|('A'..'Z')|('0'..'9') and a LABEL is like an
>> IDENTifier
>> but ends with a ':'. When I try following .g I obtain always a lexical
>> nondeterminsim which I isn't to solve:
>
> Stop trying to do that in the lexer. Let the lexer return the ID for
> both
> and then have your parsing rules distinguish between ID ":" being a
> label
> or the ID is just an ID.
>
Some languages like AREV are made much simpler if the lexer can
distinguish labels from IDs, that was the whole inspiration for my
ParserFilter example on my website.
Monty
ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit --
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list