home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!uwm.edu!rutgers!faatcrl!iecc!compilers-sender
- From: sasghm@unx.sas.com (Gary Merrill)
- Newsgroups: comp.compilers
- Subject: Re: Two-pass C compilers
- Keywords: C, design
- Message-ID: <92-08-096@comp.compilers>
- Date: 17 Aug 92 17:14:59 GMT
- References: <92-08-081@comp.compilers> <92-08-086@comp.compilers>
- Sender: compilers-sender@iecc.cambridge.ma.us
- Reply-To: Gary Merrill <sasghm@unx.sas.com>
- Organization: Compilers Central
- Lines: 46
- Approved: compilers@iecc.cambridge.ma.us
-
- As posed, this question is a pseudo-question and is unanswerable. The
- answer hinges on what we mean by "pass". As John has pointed out, the
- "classical" meaning of pass (as applied to assemblers) pertains to the
- number of times the *source* is read. With high- level languages, the
- concept of pass becomes a bit more murky, and even in the best texts there
- is confusion.
-
- For example, in _The_Theory_and_Practice_of_Compiler_Writing_, Tremblay
- and Sorenson first define "separate pass" as meaning "examine the entire
- source program". Yet two paragraphs later they conflate "phase" and
- "pass" (using both terms) in such assertions as
-
- [T]he optimization phase may require that several
- passes of the source program (or its intermediate
- form) be made.
-
- and then
-
- [T]he optimization phase is often spread throughout
- the other pases of the compilation process ...
-
- I find this second statement especially puzzling, but it is clear that
- they intend to extend the idea of "pass" to include the processing of an
- intermediate representation.
-
- If we employ this broader notion of "pass", then every C compiler known to
- me is multi-pass. Whether the intermediate representation is in a file on
- the disk, in memory, or on my notepad is irrelevant. (Note that
- frequently the intermediate representation is not textual in nature, but
- is a binary representation of a tree or a set of quadruples. In fact,
- there may be *several* intermediate representations, depending upon how
- much and what kind of optimization is desired.) But if we employ the
- narrower (classical) notion of "pass", then every C compiler known to me
- is single pass since I know of none (there *may* be some, but I can't
- imagine why) that read the original source more than once. Even those
- compilers that first generate a file of tokenized input (at least the old
- Whitesmith's compiler used to do this) are single pass since they read the
- original source only once.
-
- ---
- Gary H. Merrill [Principal Systems Developer, C Compiler Development]
- SAS Institute Inc. / SAS Campus Dr. / Cary, NC 27513 / (919) 677-8000
- sasghm@theseus.unx.sas.com ... !mcnc!sas!sasghm
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-