Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-unix!ctnews!pyramid!amdahl!ptsfa!ihnp4!inuxc!pur-ee!j.cc.purdue.edu!i.cc.purdue.edu!arthur.cs.purdue.edu!sjc From: sjc@arthur.cs.purdue.edu (Steve Chapin) Newsgroups: sci.lang,comp.lang.misc Subject: Re: Using C to describe itself Message-ID: <1286@arthur.cs.purdue.edu> Date: Fri, 24-Apr-87 14:55:18 EDT Article-I.D.: arthur.1286 Posted: Fri Apr 24 14:55:18 1987 Date-Received: Sun, 26-Apr-87 20:18:07 EDT References: <437@haddock.UUCP} <1829@enea.UUCP> <440@haddock.UUCP> <7360@boring.mcvax.cwi.nl> Organization: Department of Computer Science, Purdue University Lines: 37 Summary: Wrong answer... Xref: mnetor sci.lang:536 comp.lang.misc:364 In article <7360@boring.mcvax.cwi.nl}, steven@mcvax.cwi.nl (Steven Pemberton) writes: } In article <1403@uwmacc.UUCP> edwards@unix.macc.wisc.edu.UUCP (mark edwards) writes: } > Yes indeed C can describe itself. } } Actually, I'm not completely convinced of this. The question of whether C } can be used to describe itself or not seems to be the same as whether the } sentence "This sentence is true" is true or false: it depends on your } assumptions. } } Evidence of this is in Dennis Ritchie's Turing award lecture: he had built a } trojan horse into the C compiler. The compiler looked identical to its } previous self, but actually compiled a (slightly) different language. This } suggests to me that you can't look at the compiler source to determine what } a certain construct in C means, even if you know the meaning of the language } it compiles to. } } Steven Pemberton, CWI, Amsterdam; steven@cwi.nl or try steven@mcvax.uucp If I recall correctly, he first wrote a compiler that on a special string input, output a binary that did NOT correctly match the source code. Then he fed it a "clean" C compiler, and it output that C compiler with the additional property that it also contained the trojan horse. Thus, as long as you kept compiling the C compiler with the C compiler, you would get a trojan horse C, which would do a couple of interesting things when fed the right input file. But, the point is, that the original compiler and all its descendants were NOT (!!!!!) actual C compilers, since the did NOT correctly transform all proper inputs into equivalent outputs. So, this example is not relevant. --------------------------------------------------------------------------- Steve Chapin | Chapin's Law of Motion: ARPA: sjc@gwen.cs.purdue.edu | You can get anywhere in 10 minutes UUCP: ...!purdue!sjc | if you drive fast enough. ---------------------------------------------------------------------------