On 28 Jan 2008, at 17:43, [EMAIL PROTECTED] wrote:
Hello, everyone,
I am now working on the subject "how to generate the syntax tree
using Bison
for given C/C++ code". I have a grammar file in which the C grammar
is defined,
however, it seems that Bison doesn't generate such a syntax tree
when it is
parsing. Note that I do not want to add tree-generating code as
"action for
each rule" into the bison files, since there are almost 1000 lines
of grammar
rules.
Is there any way to complement my objective?
Thank you for reading the message and answering :)
The only way to make this happens seems to somehow get the stuff into
the actions, as Bison uses an algorithm, a form of LALR(1), to
translate the input grammar to instructions for a so called push-down
automaton. So the problem is similar to generate the language code
from the binary. But if you can automate another semantic value
component for the parse tree, plus actions for it, it might be an
interesting addition to the Bison project.
Hans Aberg
_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison