Bug in YACC discovered?

wsineel@lso.win.tue.nl (e.vriezekolk)
6 Mar 90 09:23:48 GMT

          From comp.compilers

Related articles
Bug in YACC discovered? wsineel@lso.win.tue.nl (1990-03-06)
| List of all articles for this month |

From: wsineel@lso.win.tue.nl (e.vriezekolk)
Newsgroups: comp.compilers
Date: 6 Mar 90 09:23:48 GMT
Organization: Eindhoven University of Technology, The Netherlands
Keywords: yacc,question

I offered someone to write a (small) compiler to be included
in his program. I use YACC, but I run into a strange problem.
My YACC-rules are mostly of the form:

nonterminal: A_TOKEN
{if (!some_test($1))
report("user friendly error message");
{if (!another_test($3))
report("user friendly error message");
{if (!still_more_tests($5,$6))
report("user friendly error message");
(Tab size is 4..., sorry);

The problem is that in the "final_actions" part, the value of
$1 is somehow overwritten. I encountered this in two different
places. Even if I write a rule like:

nonterm: TOKEN1

Now two different values are printed!

There is a lot of C-code between the tokens in my rules, but
this shouldn't change the $x values, does it?

Any ideas about what YACC thinks of this are welcome...

Eelco Vriezekolk

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.