Re: Two-pass C compilers

mcrware!adam@uunet.UU.NET (Adam Goldberg)
Wed, 19 Aug 1992 14:31:04 GMT

          From comp.compilers

Related articles
Two-pass C compilers maniattb@cs.rpi.edu (1992-08-15)
Re: Two-pass C compilers behrenss@Informatik.TU-Muenchen.DE (1992-08-16)
Re: Two-pass C compilers quanstro@stolaf.edu (1992-08-16)
Re: Two-pass C compilers markh@csd4.csd.uwm.edu (1992-08-16)
Re: Two-pass C compilers sasghm@unx.sas.com (Gary Merrill) (1992-08-17)
Re: Two-pass C compilers leichter@zodiac.rutgers.edu (1992-08-18)
Re: Two-pass C compilers mcrware!adam@uunet.UU.NET (1992-08-19)
| List of all articles for this month |
Newsgroups: comp.compilers,comp.lang.c
From: mcrware!adam@uunet.UU.NET (Adam Goldberg)
Organization: Microware Systems Corp., Des Moines, Iowa
Date: Wed, 19 Aug 1992 14:31:04 GMT
References: 92-08-081 92-08-086
Keywords: C

behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens) writes:
>Hmmm ... beat me if I something silly, but: Is there any way around
>a two-pass compiler? (Or even more passes)


>First pass: Reading in the source, preprocessing it, building a symbol table.
>Second pass: Generate p-Code
>Third pass: Optimize p-Code (Note: Do not mix with 2nd pass or you are
>in deep trouble)
>Fourth pass: Generate native code in linkable object file


Perhaps I'm dense, but...


Is the 'First Pass' (as defined by Soenke) the preprocessor? Even if it
is, there's no great trick (seems to me) to preprocess, build a symbol
table and output unoptimized p-Code all in the first pass through the
source. At that point, you've got p-Code (which is essentially an
internal data representation of the source) to optimize, translate into
assembler and assemble. I would call this 1 pass for the following
reasons:


  o The source code is read ONCE only.
  o Take as many passes though the p-Code as you want; the p-Code is
      (essentially) an internal representation of the partially compiled
      source. Chomp on that N times, and you're still only playing with
      internal data--hence, you have a 1 pass compiler, not a N+1 pass
      compiler.
  o The assembly output is again only an internal representation.
      Assembling it is translating internal representation(s) into output.
      Not a separate pass.




--
Adam G.
adamg@microware.com, or ...!uunet!mcrware!adamg
--


Post a followup to this message

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