hi, My interactive mode Bison program (http://cs.uic.edu/~spopuri/ibison.html) is only good to debug the structure of a grammar. It does NOT execute semantic actions.
So, if you want to look at the value of $1, $2 etc. you must be printing values on the semantic stack .. which is implemented as an array called 'yyvsp'. And yyvsp[0] is the top of the stack. This variable is actually a pointer, and it is incremented whenever a symbol (and hence its semantic value) is pushed on the parser stack. If you understand parsing, try printing values backward from yyvsp (yyvsp[-1], yyvsp[-2] etc.) otherwise it is best to insert a printf("..", $1); inside the semantic action. thanks, satya. On 11/21/06, Hans Aberg <[EMAIL PROTECTED]> wrote:
On 21 Nov 2006, at 17:26, Sean Walton wrote: > I am trying to debug bison/yacc with gdb. I want to look at the > bison variable $1 -- how do i do it? What is the syntax? (It > conflicts with the print history $##.) The $ variables are expanded to something else in the output parser. So one way is to look what Bison writes in the parser actions (in the .c or the .cc file) and debug that. Bison also has a debug feature, but I recall it just writes what is on the parser stack. And Satya is working on improved debugging - I am not sure of its current state. Hans Aberg
-- Gain control over your attention and you gain control over your life. http://cs.uic.edu/~spopuri _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison