[antlr-interest] Template for optional element

Oscar Pérez oscar at perex.org
Mon Jan 28 23:57:15 PST 2008


Hi.

I'm new in ANTLR.

I want to use a template for a rule like this:

func: ^( Func ID params* body ) -> func(name={$ID.text},
par={$params.st}, block={$body.st});

but if there aren't params in source text, then broken!!!

¿How can I write a template for optional elements?

Tanks.


More information about the antlr-interest mailing list