Hiding Yacc vars

Bruce Barnett barnett at crdgw1.crd.ge.com
Tue Jun 20 00:17:36 AEST 1989


In article <LORENSEN.89Jun15071542 at dwaskill.crd.ge.com>, lorensen at 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	<barnett at crdgw1.ge.com>  a.k.a. <barnett@[192.35.44.4]>
			uunet!crdgw1.ge.com!barnett barnett at crdgw1.UUCP



More information about the Comp.unix.questions mailing list