home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.compilers:1382 comp.lang.c:12388
- Newsgroups: comp.compilers,comp.lang.c
- Path: sparky!uunet!decwrl!world!iecc!compilers-sender
- From: maniattb@cs.rpi.edu (Bill Maniatty)
- Subject: Two-pass C compilers
- Reply-To: maniattb@cs.rpi.edu (Bill Maniatty)
- Organization: Compilers Central
- Date: Sat, 15 Aug 1992 20:45:24 GMT
- Approved: compilers@iecc.cambridge.ma.us
- Message-ID: <92-08-081@comp.compilers>
- Keywords: C
- Sender: compilers-sender@iecc.cambridge.ma.us
- Re: Why is compiled basic slower than C? (Basic is the future)
- Lines: 32
-
- |> C requires more than one pass for compilation, and
- |> therefore compiles slower than Basic.
-
- Some of the wise guys (I mean friends) in my office challenged my
- assertion that C requires more than one pass to compile. I'm of the
- impression that C compilers use more than one pass. Since they challenged
- me, I get to make up the rules of this contest which are:
- 1). Ansi 'C' is the grammar.
- 2). If we skip optimization, is there any construct in C that would
- require multiple passes, and if not how do we avoid many passes?
- 3). How about if we perform optimization (specify the optimizations
- please), can it be done in 1 pass?
- 4). Are there any one pass C compilers out there. (That is C done with
- 2+ pass compilers for purely historical reasons?)
-
- If I was wrong, I apologize for misleading anyone, but if I'm correct then
- in their face! :-)
-
- Bill
- --
- maniattb@cs.rpi.edu - in real life Bill Maniatty
- [Depends on what you mean by pass. Most C compilers I know turn C into
- assembler and only read the source once. Whether you think of the
- assembler as a second pass is a matter of semantics. Some compilers, e.g.
- Turbo C, go directly from C to object code, again only reading the source
- once. In this regard I can't see any way that C differs from Basic or
- Fortran, both of which are about equally easy or hard to process in one
- pass. PL/I is a little harder to do in one pass since you're allowed to
- declare variables after you use them. -John]
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-