[antlr-interest] C Target code generation of ANTLR 3.4 does not set ALL the rule variables to NULL

Adrian Pop Adrian.Pop at liu.se
Sat Oct 1 04:25:05 PDT 2011


Hi all,

It seems that the ANLTR 3.4 code generation for C
target does not set ALL the rule variables to NULL.
ANTLR 3.2 does set all of them to NULL.

Example:
type_specifier returns [void* ast] :
    np=name_path
    (lt=LESS ts=type_specifier_list gt=GREATER)? (as=array_subscripts)?
      {
        if (ts != NULL) {
....

In ANTLR 3.4 only the variables: "lt" and "gt" are set to NULL
at the beginning of the rule. In ANTLR 3.2 code generation all
the variables "np", "lt", "ts", "gt", "as" are set to NULL at
the rule start.

This is rather annoying as suddenly things that worked fine
with ANTLR 3.2 do not work anymore with ANTLR 3.4 (seg fault).

Is this a bug or is like this by design and we will need to
set the variables to NULL via @init or { scope } at the
start of the rule?

Cheers,
Adrian Pop/


More information about the antlr-interest mailing list