[antlr-interest] Newby Question: Hello world example with ANTLRWorks 1.2.3

Simon Gubler sgubler at gmail.com
Fri Sep 25 12:50:53 PDT 2009


Hi all

The following grammar compiles with ANTLRWorks 1.2.3 but when I debug it
with "1+2+3" it generates a Parse Tree with the following elements:
root->statement->MissingTokenException.

In the file SimplePlusGrammar.g:
grammar SimplePlusGrammar;
statement : INTEGER (PLUS INTEGER)*;
PLUS    : '+';
DIGIT   : ('0'..'9');
INTEGER : DIGIT+;


   - Can you explain what is missing in the grammar to generate a valid
   Parse Tree out of "1+2+3"
   - In many examples so far I have seen Java Code inside the *.g file. Is
   it possible to have only the grammar definition in the *.g file so that it
   can be used by different programming languages

I'm posting my questions here because I haven't found a forum or something
similar where I can put them.

Kind regards

Simon Gubler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090925/4c9768a9/attachment.html 


More information about the antlr-interest mailing list