473,796 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does C implement the first C compiler itself?

K&R says the following in the preface to the first edition,

"... the C compiler, and ... are written in C."

I'm wondering, does it say even the first / original C compiler was
written in C?

Feb 14 '07 #1
30 2979
lovecreatesbea. ..@gmail.com wrote:
K&R says the following in the preface to the first edition,

"... the C compiler, and ... are written in C."

I'm wondering, does it say even the first / original C compiler was
written in C?
Put some deductive reasoning/logic into it.
Feb 14 '07 #2
Christopher Layne wrote:
>lovecreatesbea ...@gmail.com wrote:
>K&R says the following in the preface to the first edition,

"... the C compiler, and ... are written in C."

I'm wondering, does it say even the first / original C compiler was
written in C?
Read "The Development of the C Language" at Dennis Ritchie home page (
http://cm.bell-labs.com/who/dmr )
>Put some deductive reasoning/logic into it.
[OT] That may lead you to logically correct, but nevertheless false
conclusions. The first version of an Algol-like system programming
language for Burroughs mainframes (B5000?) was written in itself.
It was "hand compiled" into assembler to get the first running
version, and it was self-sustained from there.
Roberto Waltman

[ Please reply to the group,
return address is invalid ]
Feb 14 '07 #3
Roberto Waltman wrote:
[OT] That may lead you to logically correct, but nevertheless false
conclusions. The first version of an Algol-like system programming
language for Burroughs mainframes (B5000?) was written in itself.
It was "hand compiled" into assembler to get the first running
version, and it was self-sustained from there.
You just contradicted yourself. That was my point.

The first version was written in another language.
Feb 14 '07 #4
On Feb 14, 10:09 am, Christopher Layne <cla...@com.ano dizedwrote:
Roberto Waltman wrote:
[OT] That may lead you to logically correct, but nevertheless false
conclusions. The first version of an Algol-like system programming
language for Burroughs mainframes (B5000?) was written in itself.
It was "hand compiled" into assembler to get the first running
version, and it was self-sustained from there.

You just contradicted yourself. That was my point.

The first version was written in another language.

Not so.

The compiler was _written_ in the target language. It was
_translated_ to assembly.

This is a very common process referred to as "bootstrapp ing" a
compiler. It's a very useful exercise, in that it proves (or
disproves) the utility of the language with a non-trivial application,
and provides an immediate base of test code. Compilers tend to
require a wide range of algorithmic techniques and a variety of data
structures. If your language can implement a compiler, it's likely to
be useful for most other tasks as well.

Though these days, the intermediate language would more likely be C
than assembly, the process is essentially unchanged.

I guess you could argue that the first version of the compiler was
wetware writ by the finger of God, but that probably isn't very
helpful.

Regards,

-=Dave

Feb 14 '07 #5
"lovecreatesbea ...@gmail.com" <lo************ ***@gmail.comwr ote in message
news:11******** *************@k 78g2000cwa.goog legroups.com...
K&R says the following in the preface to the first edition,

"... the C compiler, and ... are written in C."

I'm wondering, does it say even the first / original C compiler was
written in C?
Surprisingly, I understand the thought process behind this frivolous
question.

Here is another related question:

If one has the C source code for an optimizing compiler, the compiles the
compiler, creating a new compiler, and repeats this process over many
iterations, will the compiler executable get smaller and smaller each time?

(This is no more and no less frivolous than the original.)
--
David T. Ashley (dt*@e3ft.com)
http://www.e3ft.com (Consulting Home Page)
http://www.dtashley.com (Personal Home Page)
http://gpl.e3ft.com (GPL Publications and Projects)
Feb 14 '07 #6
"David T. Ashley" <dt*@e3ft.comwr ites:
>If one has the C source code for an optimizing compiler, the compiles the
compiler, creating a new compiler, and repeats this process over many
iterations, will the compiler executable get smaller and smaller each time?
But there's no guarantees that there's optimizations to be made...

--
Chris.
Feb 14 '07 #7

lovecreatesbea. ..@gmail.com wrote:
K&R says the following in the preface to the first edition,

"... the C compiler, and ... are written in C."

I'm wondering, does it say even the first / original C compiler was
written in C?
You may be interested in the following link:

<http://cm.bell-labs.com/cm/cs/who/dmr/chist.html>

Feb 14 '07 #8
"David T. Ashley" <dt*@e3ft.comwr ites:
"lovecreatesbea ...@gmail.com" <lo************ ***@gmail.comwr ote in message
news:11******** *************@k 78g2000cwa.goog legroups.com...
>K&R says the following in the preface to the first edition,

"... the C compiler, and ... are written in C."

I'm wondering, does it say even the first / original C compiler was
written in C?

Surprisingly, I understand the thought process behind this frivolous
question.

Here is another related question:

If one has the C source code for an optimizing compiler, the compiles the
compiler, creating a new compiler, and repeats this process over many
iterations, will the compiler executable get smaller and smaller each time?
No. An optimizer (if it's working properly) makes the target code run
more quickly; it doesn't change its behavior.

Suppose you have C sources for two C compilers, compiler1 and
compiler2. compiler1 includes a very clever optimizer; compiler2
doesn't. Use compiler2 to compile itself, yielding compiler2a.exe,
which compiles slowly. Use compiler1 to compile compiler2, yielding
compiler2b.exe, which compiles more quickly. But compiler2a.exe and
compiler2b.exe work the same way; the code they generate is identical.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 14 '07 #9
"David T. Ashley" wrote:
>"lovecreatesbe a...@gmail.com" wrote in message
>K&R says the following in the preface to the first edition,

"... the C compiler, and ... are written in C."

I'm wondering, does it say even the first / original C compiler was
written in C?

Surprisingly , I understand the thought process behind this frivolous
question.
Why frivolous?
>Here is another related question:

If one has the C source code for an optimizing compiler, the compiles the
compiler, creating a new compiler, and repeats this process over many
iterations, will the compiler executable get smaller and smaller each time?
[OT] No, (at least not as worded) A simple test that every
self-compiling compiler should pass, is that when compiling its own
sources it should produce exact duplicates of itself.

If you then change the sources improving the optimization algorithms,
the compiler should produce a faster and/or smaller version of itself
reaching again a steady state after a few iterations.

To expect the cycle to continue for ever is akin to expect a file
compression algorithm to always reduce a file's size, which leads to
the conclusion that all files can be compressed into a single bit.

I could not find a reference now, but I recall reading about Niklaus
Wirth using this process to evaluate optimizations for his Pascal
compilers.

An optimization that would result in a faster or smaller compiler was
integrated in the code, but increasing the complexity of the compiler
with additional optimization steps that could improve code in some
marginal cases, but would not have a significant effect in the Pascal
compiler itself, was not considered a worthwhile trade-off.

Roberto Waltman

[ Please reply to the group,
return address is invalid ]
Feb 14 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
21128
by: Evan Smith | last post by:
During a routine performance check using an event monitor, I discovered a class of query whose performance has me baffled. The monitor captured: SELECT * FROM EWM_CASE fetch first 1 rows only It took 14 seconds of CPU time to execute. After looking up the documentation on the FETCH FIRST notation I find "Limiting the result table to the first integer rows can improve performance. The database
15
2065
by: Sam Sungshik Kong | last post by:
Hello! A disposable object's Dispose() method can be called either explicitly by the programmer or implicitly during finalization. If you call Dispose, the unmanaged resources are released earlier. Thus, if you think the unmanaged resources are important, you call Dispose explicitly. My question is what's the criteria to decide the unmanaged resources are important.
6
2034
by: bramdoornbos | last post by:
Hello, I am looking for a solution to interface with C++ classes implemented in a dll compiled by gcc. This dll will be however accessed by a visual c++ compiled host (not made by me). Both implementations will share headers that define virtual c++ class interfaces.
34
3969
by: Ben Sizer | last post by:
I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH environment variable. Every time, I've had to go through and add this by hand, to have something resembling a usable Python installation. No such problems on Linux, whether it be Mandrake/Mandriva, Fedora Core, or Kubuntu. So why is the Windows...
1
2212
MrPickle
by: MrPickle | last post by:
Does a stream flush itself when it is destroyed? If so, is it best just to let the stream flush itself and only flush it when you want it's buffer synchronizing?
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10242
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.