Re: [RFC 2/8] C language

Tom Tromey
2012-01-16T19:29:13Z

>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> Here and in all the .y files, I had to add an argument to the parser and
Sergio> the lexer functions, which is a `struct parser_state *ps'.

I think 'ps' is too short a name for something used all over the file.

Sergio> +%parse-param {struct parser_state *ps}
Sergio> +%lex-param {struct parser_state *ps}

This means we would require bison.

I don't really mind us requiring bison, but I think it is a bigger issue
and would need a separate patch - and at least configury changes.

Another approach would be to temporarily make a "local global" in the .y
file, then set this local global in the entry point to the parser.

This does not solve the whole problem, but it does make things somewhat
more modular, as a first step.

Sergio> - { write_exp_elt_opcode (BINOP_COMMA); }
Sergio> + { write_exp_elt_opcode (ps, BINOP_COMMA); }

All the mechanical changes are ok. Thanks for taking this on.

Tom