Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!csd4.milw.wisc.edu!leah!rpi!crdgw1!crdgw1.ge.com!barnett From: barnett@crdgw1.crd.ge.com (Bruce Barnett) Newsgroups: comp.unix.questions Subject: Re: Hiding Yacc vars Message-ID: <864@crdgw1.crd.ge.com> Date: 19 Jun 89 14:17:36 GMT References: Sender: news@crdgw1.crd.ge.com Reply-To: barnett@crdgw1.crd.ge.com (Bruce Barnett) Distribution: usa Organization: GE Corp. R & D, Schenectady, NY Lines: 23 In-reply-to: lorensen@dwaskill.crd.ge.com (Bill Lorensen) In article , lorensen@dwaskill (Bill Lorensen) writes: > >I don't know if you can get yacc (or lex) to use your own prototype >files via some command line option. Otherwise, your modifications will >be used by everyone on the system (dangerous of course). I modified the EASE parser to use some of the routines in the Schreiner/Friedman book "Introduction to Compiler Construction with UNIX". One routine required I modify the yacc parser prototype, to replace the procedure yylex with yyyylex. I did it with the following make rule: y.tab.h parser.c: parser.y @rm -f parser.c yacc -v -d parser.y sed 's/=yylex/=yyyylex/' < y.tab.c >parser.c yyyylex was defined in parser.y, and because of the "=", sed changed the calls to yyyylex and not the procedure itself. -- Bruce G. Barnett a.k.a. uunet!crdgw1.ge.com!barnett barnett@crdgw1.UUCP