home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / compiler / 1388 < prev    next >
Encoding:
Internet Message Format  |  1992-08-16  |  1.8 KB

  1. Xref: sparky comp.compilers:1388 comp.lang.c:12397
  2. Path: sparky!uunet!usc!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!ogicse!das-news.harvard.edu!spdcc!iecc!compilers-sender
  3. From: quanstro@stolaf.edu (goon)
  4. Newsgroups: comp.compilers,comp.lang.c
  5. Subject: Re: Two-pass C compilers
  6. Keywords: C, design
  7. Message-ID: <92-08-087@comp.compilers>
  8. Date: 16 Aug 92 18:13:56 GMT
  9. References: <92-08-081@comp.compilers>
  10. Sender: compilers-sender@iecc.cambridge.ma.us
  11. Reply-To: quanstro@stolaf.edu (goon)
  12. Organization: St. Olaf College, Northfield, MN USA
  13. Lines: 22
  14. Approved: compilers@iecc.cambridge.ma.us
  15.  
  16. The moderator comments:
  17.    [Depends on what you mean by pass.  Most C compilers I know turn C into
  18.    assembler and only read the source once.  Whether you think of the
  19.    assembler as a second pass is a matter of semantics.  Some compilers, e.g.
  20.    Turbo C, go directly from C to object code, again only reading the source
  21.    once.  ...
  22.  
  23. It seems to me that the Dragon book is very careful in defining a "pass"
  24. as "reading an input file and writing an output file." [p. 20] Now in each
  25. pass you can have as many phases as you want. In theory it would be
  26. possible to construct a compiler for any compilable language as a one-pass
  27. compiler with some positive number of phases.  For C one needs to do
  28. lexical analysis, parsing, type checking, and code generation with several
  29. other phases (such as intermediate code generation and optimization) often
  30. implemented.
  31.  
  32. In practice, C compilers have generally (well, at least often) had two
  33. passes, with the output of the second fed to the assembler. However this
  34. is mostly an artifact of the memory limitations in the early days of UNIX.
  35. -- 
  36. Send compilers articles to compilers@iecc.cambridge.ma.us or
  37. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  38.