(Suppose antlr.jar is in C:\)
(1)java -classpath C:\antlr.jar antlr.Tool test.g
(2)write main, with generated files, compile and run
test.g:
class CaculatorParser extends Parser;
expr: INT PLUS INT;
class CaculatorLexer extends Lexer;
PLUS : '+' ;
INT : ('0'..'9')+ ;
2007年12月22日星期六
订阅:
博文评论 (Atom)
没有评论:
发表评论