[antlr-interest] help related to interpreted grammar for calculator
mark twain
himmy070 at gmail.com
Mon Aug 18 08:45:59 PDT 2008
Hi Every1,
I am writing the grammar for a calcluator supporting basic arithmetic
operations and is able to successfully generate the AST from my Lexer-Parser
grammar<bbcalc.g> and treeWalker grammar<bbcalcTreeWalker.g>.
Now I am writing the Interpreter grammar<bbcalcInterpreter.g> to generate
the output value from above generated AST but getting following errors. I am
new-bie to ANTLR and since last 2 days trying to figure out the problem with
interpreter grammar but still not able to resolve it :-(
***********************************************************************
error(100): bbcalcInterpreter.g:15:13: syntax error: antlr:
bbcalcInterpreter.g:15:13: unexpected token: int v = 0;
error(100): bbcalcInterpreter.g:16:22: syntax error: antlr:
bbcalcInterpreter.g:16:22: unexpected token: IDENTIFIER
error(100): bbcalcInterpreter.g:16:34: syntax error: antlr:
bbcalcInterpreter.g:16:34: unexpected token: =
error(100): bbcalcInterpreter.g:16:39: syntax error: antlr:
bbcalcInterpreter.g:16:39: unexpected token: )
warning(138): bbcalcInterpreter.g:0:0: grammar bbcalcInterpreter: no start
rule (no rule can obviously be followed by EOF)
Generating bbcalcInterpreter.c
Generating bbcalcInterpreter.h
**********************************************************************
I have attached all my 3 grammar files and it would be great if you could go
through my simple grammar files and help me in this.
Thanks...........
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080818/53469038/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bbcalc.g
Type: application/octet-stream
Size: 1203 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080818/53469038/attachment-0002.obj
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bbcalcInterpreter.c
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20080818/53469038/attachment-0001.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bbcalcTreeWalker.g
Type: application/octet-stream
Size: 345 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080818/53469038/attachment-0003.obj
More information about the antlr-interest
mailing list