[antlr-interest] Lexer rules for numbers and intervals
beckersheinzsb
beckersheinzsb at yahoo.com
Thu Aug 5 07:10:07 PDT 2004
Hello
I have the following rules in my lexer:
protected
DOT : '.' ;
protected
DIGIT : '0'..'9' ;
NUMBER : (DOT (DIGIT)+)
| (DIGIT)+ (DOT (DIGIT)*)?;
This piece works fine but now i want to add intervals, e.g. 5..9
If I try to define a rule like
INTERVAL_SIGN : DOT DOT ;
I get a nondeterminism.
I see that it is difficult to distinguish between the second subrule
of NUMBER and an interval 5..9 (NUMBER INTERVAL_SIGN NUMBER). Do I
have to left-factor?
Or is there a possibility to achieve that the lexer recognizes two
following dots as an interval sign at all?
Could you please give me a hint
thanks a lot
greets
heinz
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