|
From: | Hans Aberg |
Subject: | Re: print reduced input string |
Date: | Mon, 22 Aug 2005 18:24:04 +0200 |
On 21 Aug 2005, at 18:35, Andreas Wapf wrote:
How is it possible to print out the input value reduced by a rule insidean 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
[Prev in Thread] | Current Thread | [Next in Thread] |