[antlr-interest] modified example T.g has no output
Michael West
quagly at me.com
Sun Dec 5 11:03:17 PST 2010
I modified the an example T.g from the Definitive guide section 9.4 and now
it produces no output. I only modified the grammar to take multiple
statements. I did not change the supporting code or input. Original
grammar from the book works fine and is:
grammar T;
options {output=template;}
s : ID '=' INT ';' -> assign(x={$ID.text},y={$INT.text}) ;
ID: 'a'..'z'+ ;
INT:'0'..'9'+ ;
WS :(' '|'\t'|'\n'|'\r') {skip();} ;
My modified grammar is:
grammar T;
options {output=template;}
s : (stat) + ;
stat : ID '=' INT ';' -> assign(x={$ID.text},y={$INT.text}) ;
ID: 'a'..'z'+ ;
INT:'0'..'9'+ ;
WS :(' '|'\t'|'\n'|'\r') {skip();} ;
Sample input from the book:
x=101;
What do I need to do to get the same output while supporting multiple
statements? Why does this produce no output?
--
View this message in context: http://antlr.1301665.n2.nabble.com/modified-example-T-g-has-no-output-tp5805707p5805707.html
Sent from the ANTLR mailing list archive at Nabble.com.
More information about the antlr-interest
mailing list