[antlr-interest] added ANTLR v3 page

Sebastian Kaliszewski Sebastian.Kaliszewski at softax.com.pl
Fri Feb 3 04:45:25 PST 2006


On Tuesday 31 January 2006 22:47, Terence Parr wrote:

 > Howdy,
 >
 > I have finally added a description page for v3:


Something with the example parser is not right:


<quote>
grammar SimpleParser;
program : variable* method+ ;
variable: "int" ID ( =  expr)? ';  ;     // HUH???
method  : "method" ID '(' ')'
           '{'
               variable* statement+
           '}'
         ;
statement

         : ID  =  expr ';'
         :
         | "return" expr ';'

         ;
expr    : ID | INT ;
ID      : ('a'..'z'|'A'..'Z')+ ;
INT     : '0'..'9'+ ;
WS      : (' '|'\t'|'\n')+ {channel=99;}
         ;

Note that all literals are single-quoted...
</quote>

Line 3 probably has ' missing

And then which of "int" or "method" or "return" is single quoted?


rgds
--
Sebastian Kaliszewski



More information about the antlr-interest mailing list