[antlr-interest] handle extra things
Siva B
sivaits4u at gmail.com
Mon Nov 30 04:05:21 PST 2009
Hi all,
I have a problem when I am doing a function call with unknown number of
parameters.
suppose when I am writing grammar for sum of listed elements(no of elements
not fixed i mean an array of elements)
my code
functionCall : 'sum' '(' arg=expr {arguments=list();
arguments.append($arg.value); } (',' e=expr {arguments.append($e.value);})*
')' { print sum(arguments);};
this works fine with sum(1,2,3)
and also works fine with sum(1,2,3,)
but the next statemnts( let sum(2,3,4) .... )are not getting executed
because of the extra comma present in the second function call sum. i mean
interpreter is exiting.
I am not able to find solution.
plz help me
Thanks in Advance
Siva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091130/ea355f80/attachment.html
More information about the antlr-interest
mailing list