home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.compilers:1416 comp.lang.c:12583
- Path: sparky!uunet!stanford.edu!rutgers!faatcrl!iecc!compilers-sender
- From: mcrware!adam@uunet.UU.NET (Adam Goldberg)
- Newsgroups: comp.compilers,comp.lang.c
- Subject: Re: Two-pass C compilers
- Keywords: C
- Message-ID: <92-08-115@comp.compilers>
- Date: 19 Aug 92 14:31:04 GMT
- References: <92-08-081@comp.compilers> <92-08-086@comp.compilers>
- Sender: compilers-sender@iecc.cambridge.ma.us
- Reply-To: mcrware!adam@uunet.UU.NET (Adam Goldberg)
- Organization: Microware Systems Corp., Des Moines, Iowa
- Lines: 37
- Approved: compilers@iecc.cambridge.ma.us
-
- 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
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-