Path: utzoo!mnetor!uunet!husc6!ncar!ames!pacbell!att-ih!alberta!edson!tic!dragos!work From: work@dragos.UUCP (Dragos Ruiu) Newsgroups: comp.unix.microport Subject: Re: YAMB: problems with yacc? Message-ID: <397@dragos.UUCP> Date: 22 Mar 88 02:44:29 GMT References: <437@splut.UUCP> Organization: UNIX Device Lines: 36 Keywords: won't do hoc1 right Summary: Confirm Yacc Problem 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: > expr: expr '+' expr { $$ = $1 + $3 }... > by simply returning $3, instead of computing the sum. I have checked the > program against the printed source in the book twice, and found no > errors. Neither yacc nor cc complain during compilation of the program. > Vitals: System V/AT (286) 2.3.0, plenty of (hard and ram-) disk. > > -- > Jay Maynard, EMT-P, K5ZC...>splut!< | GEnie: JAYMAYNARD CI$: 71036,1603 > uucp: {uunet!nuchat,academ!uhnix1,{ihnp4,bellcore,killer}!tness1}!splut!jay I also encountered the bug in yacc. It seems to be in the add/sub/mult/div of two floating point numbers. I spent a bit of time looking over this problem... but I eventually discarded my work and tried the desc calculator program I wrote on BSD and HP-UX systems and they worked there. I can dig up the sources in a day, but if my memory serves me correctly, it's not a Yacc problem... I believe it was a bug in the c compiler as I went and actually debugged the yacc output. There is a large set of indirection and structure references produced by yacc, and printfs on the intermediate results and actual results just don't match. Unfortunately I don't have time to track down this bug anymore. I can email the sources which produce bugs to interested parties. Or if enough people are interested I can post them. They aren't long. -- Dragos Ruiu ruiu@dragos.UUCP ...alberta!dragos!ruiu OS/2... No thanks I have a pencil. Disclaimer: These are my employers opinions. I'm unemployed.