Article View: sci.lang
Article #2479Re: Using C to describe itself
From: Adam Quantrill
Date: Tue, 12 May 1987 08:23
Date: Tue, 12 May 1987 08:23
33 lines
2126 bytes
2126 bytes
In article <7360@boring.mcvax.cwi.nl> steven@cwi.nl (Steven Pemberton, or try steven@mcvax.uucp) 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 [] Ritchie built a
>trojan horse into the C compiler. The compiler looked identical to its
>previous self, but actually compiled a (slightly) different language. This
>
>[] 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
Yes, but I hold that any language that can parse itself, can describe itself.
A non-rigorous argument follows:
1. If the language L can parse itself, it can break down any program into
L primitives.
2. L can implement L primitives.
3. So L can implement any program in L, thus it can describe L given a suitable
parser program.
This is defining L in terms of implementation, not a theoretical description.
As C can parse itself (evidence - cc) I reckon there's a good case that it
can describe itself. The 'trojan horse' compiler mentioned above may be
able to implement 'trojan horse' C, but not C.
-Adam.
/* If at first it don't compile, kludge, kludge again.*/
Technical Details
Message-ID:
<573@gec-mi-at.co.uk>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!hrc63!miduet!misoft!adamReferences:
<437@haddock.UUCP> <1829@enea.UUCP> <440@haddock.UUCP> <1403@uwmacc.UUCP> <7360@boring.mcvax.cwi.nl>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!ukc!hrc63!miduet!misoft!adam From: adam@gec-mi-at.co.uk (Adam Quantrill) Newsgroups: sci.lang,comp.lang.misc Subject: Re: Using C to describe itself Message-ID: <573@gec-mi-at.co.uk> Date: Tue, 12-May-87 04:23:43 EDT Article-I.D.: gec-mi-a.573 Posted: Tue May 12 04:23:43 1987 Date-Received: Sat, 16-May-87 11:10:18 EDT References: <437@haddock.UUCP> <1829@enea.UUCP> <440@haddock.UUCP> <1403@uwmacc.UUCP> <7360@boring.mcvax.cwi.nl> Sender: news@gec-mi-at.co.uk Reply-To: adam@gec-mi-at.co.uk (Adam Quantrill) Organization: Marconi Instruments Ltd., St. Albans, UK Lines: 33