Related articles |
---|
Two pass compiler using YACC? wsineel@info.win.tue.nl (1990-08-22) |
Re: Two pass compiler using YACC? mkie@vlsivie.at (1990-08-23) |
Re: Two pass compiler using YACC? tbr@virgil.tfic.bc.ca (1990-08-24) |
Re: Two pass compiler using YACC? bart@videovax.tv.tek.com (Bart Massey) (1990-08-25) |
Re: Two pass compiler using YACC? sja@sirius.hut.fi (1990-08-25) |
Re: Two pass compiler using YACC? meissner@osf.org (1990-08-27) |
Two pass compiler using YACC? jar@florida.eng.ileaf.com (1990-09-02) |
Two pass compiler using YACC? meissner@osf.org (1990-09-06) |
Newsgroups: | comp.compilers |
From: | sja@sirius.hut.fi (Sakari Jalovaara) |
In-Reply-To: | tbr@virgil.tfic.bc.ca's message of 24 Aug 90 20:36:19 GMT |
Keywords: | C, yacc |
Organization: | Helsinki University of Technology |
References: | <9008242036.AA10670@virgil.tfic.bc.ca> |
Date: | 25 Aug 90 20:03:44 |
>>The problems come during link-time, for ld, obviously, complains about
>>multiple defined symbols (such as yylval and yyparse).
[solution with a sed script]
How about an include file, say, yyrename.h (warning - untested code
ahead):
#define yyGLUE1(x,y) x ## y
#define yyGLUE(x,y) yyGLUE1 (x, y) /* There may be an
* easier way...
*/
#define yyparse yyGLUE (yyparsername,_yyparse)
#define yylex yyGLUE (yyparsername,_yylex)
#define yychar yyGLUE (yyparsername,_yychar)
...etc...
and in parse.y:
%{
#define yyparsername my_parser
#include "yyrename.h"
my_parser_yylex () { ...lexer goes here... }
%}
++sja
[No question, there are arbitrarily ugly ways to make this work. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.