[antlr-interest] Parsing an IP Address
madison_stjames
madison_stjames at yahoo.com
Mon Mar 31 18:23:11 PST 2003
I am trying to parse an IP address using the following:
In the Lexer:
DOT : '.'
;
IPSEG : ( ('1'('0'..'9')('0'..'9'))|('2'('0'..'4')('0'..'9'))
|('2''5'('0'..'9'))|(('1'..'9')?('0'..'9')) )
;
In the Parser:
seg
: s:IPSEG
{}
;
ip
: i: seg DOT seg DOT seg DOT seg
{Console.Out.WriteLine(i.getText());}
;
I am getting a number of errors: one says that the type or
namespace 'i' cannot be found, and another says that the type or
namespace "lexer" cannot be found.
Obviously, it's a syntax error, but I haven't been able to determine
the fix on my own.
I am trying to keep my tokens relatively small, and perform most of
the assembly in the parser.
Is there a way to do this?
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list