Xref: utzoo comp.unix.questions:14270 comp.lang.c:19337 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!mit-eddie!uw-beaver!cornell!rochester!pt.cs.cmu.edu!andrew.cmu.edu!bobg+ From: bobg+@andrew.cmu.edu (Robert Steven Glickstein) Newsgroups: comp.unix.questions,comp.lang.c Subject: Hiding Yacc vars Message-ID: Date: 13 Jun 89 21:24:20 GMT Organization: Information Technology Center, Carnegie Mellon, Pittsburgh, PA Lines: 25 I'm sure some of you have encountered this problem before. Both Yacc and Lex make all of their identifiers external, when in fact they should be static. This becomes a major problem when you have large software projects in which zillions of libraries are linked together, any two of which might define yyparse, yytext, yylength, etc., leading to a name conflict. The kludgy solution that we've been using at the ITC has been to run lex.yy.c and y.tab.c through sed, changing all instances of "yy" to "fooyy". The right solution (short of hacking Yacc and Lex themselves) is to run the output files through a postprocessor to make all the "yy"-something declarations static. This postprocessor would optionally preserve the external-ness of yylex and yyparse, but it would be able to rename them to something the programmer specified. (I call this an option because another behavior would be to leave yylex and yyparse static, and provide interface routines in the files foo.l and bar.y to get at the parser and tokenizer.) Anyway, does such a postprocessor exist? If not, I plan to write one; how much interest do you folks have in seeing it written? Gratefully, Bob Glickstein Information Technology Center Carnegie Mellon University Pittsburgh, PA