[antlr-interest] Which one is quicker?

chain one chainone at gmail.com
Fri Dec 26 00:45:15 PST 2008


1.INT :   '-'? DIGIT+
;
FLOAT

:   ('-'|'+')? DIGIT+  '.' DIGIT* (('e' | 'E') ('+' | '-')? (DIGIT)+)?
     ;

2.
INT_OR_FLOAT
  : '-'? DIGIT+ FLOAT?
 ;

fragment
FLOAT

:   '.' DIGIT* EXPONENT?
     ;

fragment
EXPONENT: ('e' | 'E') ('+' | '-')? (DIGIT)+;


Which one is quicker?
I think the 2th is quicker. Because in the 1st lex rule, A DFA is needed to
predict if it is a INT or FLOAT.
Am I right?


Thanks
Best Regards,
Young
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081226/ea117c14/attachment.html 


More information about the antlr-interest mailing list