On 21 Aug 2005, at 18:35, Andreas Wapf wrote:
How is it possible to print out the input value reduced by a rule
inside
an action .
As an example:
stmts: stmts, stmt
| stmt
{
printf(???);
}
For example stmt is an "if a then b" statement. The $1 value of this
stmt returns me a "if" node. I do not like to print the node, insteed
the printf(???) should output "if a then b". Is this possible?
Assuming that your semantic values rpoduces strings, the in
pseudocode, you would write something like:
conditional:
IF boole THEN statement ELSE statement {
print "if " + $2 + " then " + $4 + " else " + $ 5
}
And similar for all other rules.
Hans Aberg
_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison