YAMB: problems with yacc?

Mark Zenier markz at ssc.UUCP
Wed Mar 23 09:48:03 AEST 1988


In article <437 at splut.UUCP>, jay at splut.UUCP (Jay Maynard) writes:
> I tried entering the program hoc1, from the book _The Unix Programming
> Environment_, and compiling it last night. It doesn't run: when fed an
> expression like 2+2, instead of printing 4, it prints 2. It appears to
> reproduce productions of the form:... (many lines deleted)

After this posting and the one from nix, I typed in hoc1 and tried it.
Yup it blew up. 

It even printed out the bad values in the action, right after the addition. 

Hmmmm, after I converted the stack and NUMBER type from double to long 
it worked.

In summary, its the damn floating point in the c compiler choking on the
references to the stack.

example 
	yylval = yypvt[-2] + yypvt[-0];

This compiler is a piece of dung when it comes to floating point.

For a real debugging thrill, try using 1.0e-7 as an initializer, and
then try to figure out why the assembler blows up.

Mark Zenier



More information about the Comp.unix.microport mailing list