home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.scheme
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!udel!louie!hercules.cis.udel.edu!carroll
- From: carroll@hercules.cis.udel.edu (Mark C. Carroll)
- Subject: Re: Abelson&Sussman; Lisp vs C in Compilers/Prog. Lang class; etc.
- Message-ID: <1992Jul23.200958.18546@udel.edu>
- Sender: usenet@udel.edu (USENET News Service)
- Nntp-Posting-Host: hercules.cis.udel.edu
- Organization: University of Delaware, Newark
- References: <865.9207201558@subnode.aiai.ed.ac.uk>
- Date: Thu, 23 Jul 1992 20:09:58 GMT
- Lines: 68
-
- In article <865.9207201558@subnode.aiai.ed.ac.uk> jeff@aiai.edinburgh.ac.UK (Jeff Dalton) writes:
- >> Date: 16 Jul 92 20:36:04 GMT
- >> From: "Mark C. Carroll" <carroll@hercules.cis.udel.edu>
- >
- >> The main distinguishing characteristic of SML is that it is an
- >> exceptionally strongly statically typed language. The typing system is
- >> considered to be an absolutely godsend to some people (like me), and
- >> an absolutely abomination by others.
- >>
- >> For writing a system like a compiler, I find that the overwhelming
- >> majority of errors that I tend to make are captured by the ML
- >> typechecker, so that when I finally get a module to typecheck, that
- >> module works perfectly. (For more general types of programming,
- >> typechecking will catch some, but not all bugs. But as I said, in a
- >> compiler, the kind of errors that people seem to make are almost
- >> always revealed during the typecheck.)
- >
- >Note that you've gone from "some people (like me)" and "the majority
- >of errors I make" to "in a compiler ... the kind of errors people seem
- >to make".
- >
- >But I've just been working on some compilers, and type checking
- >wouldn't have helped _me_ very much (at least not this time), so
- >I have some doubts about your generalization.
- >
-
- Well.. first, have you ever worked with an ML-like type system?
-
- If you're only typing experience is with Pascal/Ada, then you're
- certainly going to think that typing systems are not useful in a
- compiler. But the SML type system is very different...
-
- In a compiler, the typical errors seem to come from abusing the data
- structures - things like performing some kind of manipulation of the
- parse tree on a parse tree node where it's innappropriate, or
- inconsistencies in the handling of the intermediate form accross
- different constructs, etc. In a typing system like Ada, you probably
- won't catch that kind of error. In SML, it always catches you.
-
- In effect, for a compiler type project, typing becomes almost a system
- of checked assertions insuring that calls are consistent. In both my
- own compilers, and in all of the compilers that I've seen by other
- people, it seems that the majority of errors (with the exception of
- errors in the generated code) are caused by inconistency within the
- manipulation of the internal data structures.
-
- If I'm wrong with respect to your personal style of compiler
- programming, I'm sorry. I'm speaking from very empirical evidence, and
- it's certainly possible that I've read a cluster of very non-typical
- compilers. Obviously, I don't believe that that's the case, but hey,
- even I can be wrong sometimes :-). (And, of course, in any case,
- things like this are _never_ universal. The best language to write a
- compiler depends not just on the compiler being written, but on the
- compiler author. A language that it perfect for me to write a compiler
- in could be the worst possible language for you to write the same
- compiler in.)
-
- <MC>
-
- [ Mark Craig Carroll <MC> ] You say you know no tricks, have no talents -
- [ U of Delaware, CIS Dept ] Isn't everyone supposed to have their own?
- [ Grad Student/Lab Hacker ] Yes, but few are obvious. Few draw notice to those
- [ carroll@udel.edu ] who posess them, like flags waving themselves.
- --
- || Mark Craig Carroll: <MC> ||"I live to see my fondest dreams realized,
- || Univ of Delaware, Dept of CIS|| Of living under the sights and sounds of
- || Grad Student/Labstaff Hacker || the gifted, Who gave so much to me"
- || carroll@udel.edu || - _Feed_the_Fire_, Happy Rhodes
-