On 21 Dec 2006, at 00:34, Tony Li wrote:

I have a small proposal that I'd like to float.

In building a parse tree for a complex language, it's very helpful to identify which nodes correspond to which productions in the grammar. Bison already has internal identifiers for each non- terminal and carries around ASCII strings for each in yytname[]. What I'd dearly love to see is the ability (probably as an option) to export these symbols into y.tab.h, preferably as part of an enum.

It's possible to generate this by hand, but as it's not automatically maintained today, any significant change in the grammar requires a manual update of the symbols. This is Not Fun.

Bison just writes this stuff out via some M4 macros in the skeleton file. So just make a personal copy of the skeleton file (typically in /usr/local/share/), tweak it, include in the project, and invoke it using %skeleton or --skeleton. If you find a useful tweak, you can report it back as a feature suggest in the Bug-Bison list.

  Hans Aberg




_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to