Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!uw-june!uw-entropy!dataio!pilchuck!ssc!markz From: markz@ssc.UUCP (Mark Zenier) Newsgroups: comp.unix.microport Subject: Re: YAMB: problems with yacc? Message-ID: <1115@ssc.UUCP> Date: 22 Mar 88 23:48:03 GMT References: <437@splut.UUCP> <254@xinx.UUCP> Organization: SSC, Inc., Seattle, WA Lines: 26 Keywords: won't do hoc1 right Summary: Its Not YACCs fault In article <437@splut.UUCP>, jay@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