[antlr-interest] How does one handle variable number of
functionparameters?
Jos Fries
ga-fries at veenendaalnet.nl
Tue Nov 29 09:52:30 PST 2005
Bryan,
Brilliant! :-) Thank you for the example. I immediately applied it in my
treeparser and it made me understand semantic actions a lot better.
Jos
----- Original Message -----
From: "Bryan Ewbank" <ewbank at gmail.com>
To: "ANTLR Interest" <antlr-interest at antlr.org>
Sent: Tuesday, November 29, 2005 4:28 PM
Subject: Re: [antlr-interest] How does one handle variable number of
functionparameters?
If you need to print out the function call later, that also
gives you a production into which you can place the parens and comma:
arglist:
#( ARGLIST
{ cout << "("; }
(
expr
(
// commas *between* expressions, not *after* expressions
{ cout << ", "; }
expr
)*
)?
{ cout << ")"; }
)
;
More information about the antlr-interest
mailing list