[antlr-interest] how to deal with optional parameters in ast

Gavin Lambert antlr at mirality.co.nz
Tue Mar 27 14:13:22 PDT 2007

At 07:51 28/03/2007, Dave Cramer wrote:
 >OK, then in the treewalker I am going to eventually call a
 >function called wakeUp(int seconds) where if the optional
 >seconds is not provided I will default it to something. The
 >question really is how to write the treewalker with two
 >possibililties; one with the param, one without ?

I can't answer that directly, as I've never written a treewalker 
myself.  But I don't see how you could call that function with the 
grammar you specified, since it can have any number of parameters 
from 0 to infinite.  Perhaps you meant to use ? instead of *?

More information about the antlr-interest mailing list