[antlr-interest] Odd problem about ANTLR
lin cyrix
cyrixlin at yahoo.com
Thu Jan 4 02:20:24 PST 2007
Hi, everybody,
I try to learn ANTLR (2.7.5) to write a small
calculator. I compose the file calc.g, generating java
class files with ANTLR 2.7.5 (also 2.7.7 with this
problem), it's ok. But when I compile the generated
java files, it fails, and obviously wrong code in it.
Such as:
(In ArithParser.java)
//////////////////////////////////
public final double neg_expr() throws
RecognitionException, TokenStreamException {
double result = 0;
if ( inputState.guessing==0 ) {
double value = 0;
}
match(MINUS);
value=atom_expr();
if ( inputState.guessing==0 ) {
result = - value;
}
return result;
}
//////////////////////////////////
Can anyone tell me what's wrong ? Is it a bug in
ANTLR, or I make some mistakes in my calc.g ?
Thanks a lot in advance.
Cyrix Lin
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: calc.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20070104/125abca0/attachment.pl
More information about the antlr-interest
mailing list