pandit Posted August 5, 2012 Posted August 5, 2012 In which language did first compiler on the earth was written? Basically compiler is a program written in some language to compile other programs but how does a compiler program will compile?
John Cuthber Posted August 5, 2012 Posted August 5, 2012 (edited) It will have been written in machine code or assembly language. http://en.wikipedia.org/wiki/Machine_code http://en.wikipedia.org/wiki/Assembly_language Edited August 5, 2012 by John Cuthber
Ben Banana Posted August 5, 2012 Posted August 5, 2012 As all of their programs, not only the first auto-codes, people "compiled" by hand into machine code.
md65536 Posted August 5, 2012 Posted August 5, 2012 http://en.wikipedia.org/wiki/Compiler#History answers both questions. "Towards the end of the 1950s machine-independent programming languages were first proposed. Subsequently several experimental compilers were developed. The first compiler was written by Grace Hopper, in 1952, for the A-0 programming language. The FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler in 1957. COBOL was an early language to be compiled on multiple architectures, in 1960." "Early compilers were written in assembly language. The first self-hosting compiler — capable of compiling its own source code in a high-level language — was created in 1962 for Lisp by Tim Hart and Mike Levin at MIT. Since the 1970s it has become common practice to implement a compiler in the language it compiles, although both Pascal and C have been popular choices for implementation language. Building a self-hosting compiler is a bootstrapping problem—the first such compiler for a language must be compiled either by hand or by a compiler written in a different language, or (as in Hart and Levin's Lisp compiler) compiled by running the compiler in an interpreter." Two things I can think of that would help in writing self-hosting compilers are: 1. A compiler needn't output a working executable. It might output say assembly code, or even c code. So the "first version of a self-hosting compiler" would not need to do all of the work involved in having a running compiler. I would assume compilers are built in steps, with a more-complex version of a compiler using a previous simpler version to compile itself. The earlier simpler versions would rely on other existing programs, or hand-compiled code, more than later versions would. 2. You do not need to use all of the complex features of a language in order to implement those features. For example, a c++ compiler can be implemented using only c code, which the resulting c++ compiler can still compile.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now