[antlr-interest] need help on this grammar

zzhao86 zzhao86 at yahoo.com
Tue May 4 13:47:17 PDT 2004


Hi,

I am having problem building a parser that can parse an expression 
with edge literals like this:

01 abc -> hl xyz 

meaning a "01" (0-to-1) change happens on "abc" variable, followed by 
a "hl" (high to low) change on "xyz" variable. "01" and "hl" are 
edge_literals, along with "10", "lh", "0h", "1h", "0l", etc.

when I put in the lexer rules like this:

Idenfier :
    ('a'..'z')('a'..'z'|'_')*
    ;

Edge_literal :
    ('0' | '1' | 'l' | 'h')('0' | '1' | 'l' |'h')
    ;

Integer :
    ('0'..'9')('0'..'9' | '_')+
    ;

the lexer will return an edge_literal token wheneve I have an 
identifier which contains "hl" or "lh" (suchas "coolhat", or an 
integer which contains "01" or "10" (such as "4105").

What am I doing wrong? Please help. Thanks a lot

zzhao86








 
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