Two pass compiler using YACC?

wsineel@info.win.tue.nl (e.vriezekolk)
Wed, 22 Aug 90 21:42:19 GMT

          From comp.compilers

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)
[1 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: wsineel@info.win.tue.nl (e.vriezekolk)
Keywords: yacc, parse, question
Organization: Eindhoven University of Technology, The Netherlands
Date: Wed, 22 Aug 90 21:42:19 GMT

Hi,


We are working on a compiler, using yacc. The compiler will be two-pass,
and we have a different .y file for both passes. Each .y file is
translated by yacc to pass.1.C and pass.2.C (we are using C++).


The problems come during link-time, for ld, obviously, complains about
multiple defined symbols (such as yylval and yyparse).


This must be a traditional problem. How is it solved?
--
Eelco Vriezekolk, wsineel@win.tue.nl
[I hope the grammars for the two passes are the same, and just the { }
actions are different. I always do the obvious thing, if(pass1)... else ...
in the action routines. In about half the cases, the action routines do
something simple like look up an identifier in the symbol table, so the
conditional code is buried in the lower level routine. Having separate yacc
grammars seems to me to be a poor idea if for no other reason than that it is
a big problem to keep the two files in sync when you make a grammar change.
-John]


--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.