[antlr-interest] variable number of arguments to a function

Siva B sivaits4u at gmail.com
Tue Nov 24 23:27:43 PST 2009


Hi All,

I am trying to write a small interpreter.
I have a small issue with function and its unknown number of arguments.
If I have different functions in my source and if want to call the
particular function based on the input , my grammar is like this.

functionCall {Result arg;}:
  id:IDENTIFIER ( arg=expr { arguments.add(arg); })*
  { callFunc(#id.getText(), arguments); }

But here arguments is an array .
So the arguments array is passed to that function.
I don't want to pass array a parameter . I want to pass the elements inside
the array as parameters.
Can Anybody post me some solution ASAP ???

plz let me know if you have any doubts...

Thanks in Advance,
Siva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091125/24f3c4a7/attachment.html 


More information about the antlr-interest mailing list