At 06:32 2/05/2009, Bill Steer wrote: >INT : (DIGIT)+ ; >FLOAT : INT > | INT '.' INT > | '.' INT >; >CONSTANT: FLOAT > | FLOAT ('e' | 'E') ('+' | '-')? INT >; [...] >IDENT : LETTER (LETTER | DIGIT)* ; >REGISTER: IDENT ('!'IDENT)* ;
You're quite likely to run into parsing trouble with these rule defintions. Remember that lexer rules are executed without parser context; ANTLR will choose a rule based solely on what the input looks like, so having multiple top-level lexer rules that accept exactly the same input isn't really a good idea. You should probably merge and left-factor these rules, and modify the parser rules to eg. accept either an INT or a FLOAT token in contexts where it is expecting a FLOAT, and an IDENT or REGISTER where it is expecting a REGISTER. (And the distinction between FLOAT and CONSTANT doesn't make much sense to me. Shouldn't that be part of FLOAT?) List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-interest@googlegroups.com To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---