Fwd: passing down value of terminal

2006-11-22 Thread vlad florentino
In gnu bison: I have a couple of productions of this type: ID '.' complex : {...} ; complex : FOOBAR {...} ; How can I pass the value of ID, a terminal, down to the production 'complex', a non terminal. I would like to determine what's the value of ID and take actions based on that, i.e.:

Re: passing down value of terminal

2006-11-22 Thread Hans Aberg
On 22 Nov 2006, at 19:41, vlad florentino wrote: In gnu bison: I have a couple of productions of this type: ID '.' complex : {...} ; complex : FOOBAR {...} ; How can I pass the value of ID, a terminal, down to the production 'complex', a non terminal. I would like to determine what's the

Re: Memory Leaks

2006-11-22 Thread Hans Aberg
On 22 Nov 2006, at 19:31, Paulo J. Matos wrote: > Which means that since I'm using a C generated parser I should use > destructor. But destructor will be called after each successful action > or after each failed parsing (to which an action never gets called but > the given value is actuall

Re: passing down value of terminal

2006-11-22 Thread Hans Aberg
You can still put it into the parser function, so that it is global to the parser, but not the parser function. But try putting in the first rule. Hans Aberg On 22 Nov 2006, at 20:23, vlad florentino wrote: I guess the global variable is the best choice, then. I was trying to avoid glo

Re: passing down value of terminal

2006-11-22 Thread Hans Aberg
[Please keep the CC to Help-Bison, so other knows what is going on.] I don't recall how, but I think one might put it in the beginning of the parser function, so tha the function then becomes pure. But try: ID '.' complex { if( strcmp($1.value,"this") == 0) doThis(); else

passing down value of terminal

2006-11-22 Thread vlad florentino
In gnu bison: I have a couple of productions of this type: ID '.' complex : {...} ; complex : FOOBAR {...} ; How can I pass the value of ID, a terminal, down to the production 'complex', a non terminal. I would like to determine what's the value of ID and take actions based on that, i.e.: