[antlr-interest] Is there a way to pass parameters to rules?

Ken and Timi Cecka ceckak at alumni.washington.edu
Fri Dec 23 16:31:03 PST 2005


Hi All,

I know rules can return a value with the 'returns' keyword, but is there any
way to pass a value to a rule when it's invoked?

In developing my treeparser, I'm repeatedly finding that I want a rule to
simply modify the object being constructed by the caller, and it's not
always easy or convenient to construct a return type that temporarily
encapsulates the results of the rule so that they can be passed up.  It
would be much simpler of the caller could pass a pointer down and allow the
rule to modify the object directly.

Ken



More information about the antlr-interest mailing list