Fwd: [antlr-interest] Antlr noobie, nondeterminism abounds
Bryan Ewbank
ewbankb at yahoo.com
Sun May 9 06:21:05 PDT 2004
> 1) Create a lexer rule representing exactly four decimal digits.
> 2) Create a lexer rule representing any 32-bit unsigned decimal
> value.
I'd do this as one lexer rule with a special case; use #2 as the
rule, but then recognize the special case of #1 and return a
different value. Does 0001 match #1, or is that considered octal?
> 1) Create a lexer rule representing ASCII characters 1..7F (call it
> CHAR).
> 2) Create a lexer rule representing ASCII characters 1..FF (call it
> CHAR8).
> 3) Create a lexer rule represeting everything in CHAR *except* '\r'
> and '\n'.
Here #2 is the biggee, so start there, then make special cases for
the other two.
disclaimer: I'm new to antrl, and learned this with lex/yacc -
recognize general tokens, then use a table (or whatever) to add
special cases.
=====
- Bryan Ewbank <><
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
http://hotjobs.sweepstakes.yahoo.com/careermakeover
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