[antlr-interest] Status of Ruby binding?

Clifford Heath clifford.heath at gmail.com
Mon Oct 15 14:24:50 PDT 2007


I'm trying to use the Ruby binding, and it's apparent that the documentation is
out of date. However, just referring to the actual behavior of 3.0.1, I have a
few issues and don't know if it's the binding or the expected behavior of ANTLR.
Specifically:

rule : ( rule2 '=' )? rule3
	{ $rule2 may or may not exist here }

In Ruby, variables get created when they're assigned. If lookahead determines
that rule2 doesn't apply, $rule2 never gets assigned, so the reference to it
in the code causes an error at runtime. In other cases, variables get initialized
to nil at the start of the function, so if they're not assigned it doesn't matter.

What's the expected behavior here?

Clifford Heath.



More information about the antlr-interest mailing list