Table of Contents
hide
History
Early Beginnings (1940s–1950s)
-
- The history of compilers started in the late 1940s with early ideas for automatic programming.
- In 1949–1951, Heinz Rutishauser proposed Superplan, a high-level language with an automatic translator, refined by Friedrich L. Bauer and Klaus Samelson.
- Grace Hopper coined the term “compiler” in 1952 for her A-0 system at Remington Rand, which acted more like a linker for mathematical formulas into machine code.
- In 1952, Alick Glennie created the first Autocode compiler for the Manchester Mark 1, marking the first compiled programming language.
First Major Compilers (1950s)
-
- John Backus led IBM’s team to develop FORTRAN from 1954–1957, releasing the first commercially viable high-level language compiler in 1957 after 18 person-years of effort; it introduced key phases like lexical analysis and code generation.
- Corrado Böhm wrote the first practical compiler in 1951 for his PhD thesis.
Advancements and Compiler-Compilers (1960s–1970s)
-
- Tony Brooker created the first “compiler-compiler” (self-compiling compiler) in 1960 for Atlas computers at the University of Manchester.
- The 1960s saw NELIAC, the first self-compiling compiler on USQ-17 hardware.
- Ken Thompson used TMG in 1969–1970 to build the B language compiler on PDP-7, precursor to C (1972 at Bell Labs).
- ALGOL compilers and optimization techniques advanced during this era.
Modern Era (1980s–Present)
-
- Compilers evolved for object-oriented languages like C++ and Java, adding semantic analysis and cross-platform support.
- Tools like Yacc (1970s) and Lex enabled parser generation.
- Today, optimizing compilers handle complex features for efficiency across architectures.
Basics of Translator
Basics of Compiler
Definition
- A compiler is a complex software program (next to an operating system) that translates source code written in a high-level programming language into machine-readable code, such as assembly or executable files, through a series of structured phases.
Types of Compiler
There are several common compilers used for different purposes –
1. Single-Pass Compiler
- A single-pass compiler is a compiler that scans the entire source program only once and generates the target code in the same pass. It does lexical analysis, parsing, semantic analysis, and code generation in one traversal.
- A single-pass compiler is a compiler that processes the source code in one pass, meaning that each statement is read, analyzed, and translated into machine code immediately.
- It translates each statement as soon as it is read.
- This compiler is faster but cannot perform deep optimizations.
- This compiler uses less memory.
- This compiler works best for small/simple programming languages like early versions of Pascal or BASIC, Turbo Pascal, some simple assemblers, etc.
2. Multi-Pass Compiler
- This compiler processes the code in multiple passes (scanning, parsing, optimization, code generation).
- This compiler is slower but produces better optimized machine code.
- This compiler is used for modern programming languages.
3. Cross Compiler
- A Cross Compiler is a compiler that runs on one system but generates executable code for another system/architecture.
- This compiler compiles code on one machine but generates an executable for another machine.
- This compiler is used in embedded systems development.
- For example, the GCC ARM cross-compiler is compiling on a Windows environment and generates code for ARM (Arduino, Raspberry Pi).
4. Just-In-Time (JIT) Compiler
- This compiler compiles code during runtime (not before execution).
- This compiler combines both interpretation + compilation.
- This compiler is used in Java (JVM), .NET CLR, Python PyPy, etc.
5. Ahead-of-Time (AOT) Compiler
- This compiler compiles code into machine code before execution, not at runtime.
- This compiler is used in C, C++, Rust, etc.
- This compiler has a Faster start-up time compared to JIT.
6. Source-to-Source Compiler (Transpiler)
- This compiler converts source code from one high-level language to another.
- For example:-
- TypeScript → JavaScript
- C → LLVM IR
- Babel (ES6 → ES5)
7. Native Code Compiler
- This compiler generates native machine code for a specific OS/CPU.
- This compiler produces fast executables.
- This compiler is used in C/C++, Go, Rust, etc.
8. Bytecode Compiler
- This compiler converts source code into an intermediate form called bytecode.
- Bytecode is executed by a virtual machine (VM).
- This type of compiling is used in Java, Python (.pyc), Kotlin, Scala, etc.
9. Incremental Compiler
- This compiler recompiles only the modified parts of the program.
- This compiler speeds up development.
- This compiler is used in IDEs, modern build tools.
10. Interpreter-based Compiler (Hybrid Compiler)
- This compiler is a combination of a Compiler and an interpreter.
- For example: – Java, Python, MATLAB, etc.
11. Optimizing Compiler
- This compiler focuses on improving execution speed and reducing memory usage.
12. Decompiler
- This compiler converts machine code back to source code.
- This compiler is used in reverse engineering.
13. Cross-Platform Compiler
- A Cross-Platform Compiler produces programs/codes that can run on multiple platforms, usually by generating platform-independent code or bytecode.
- For example,
- Java compiler (
javac) generates bytecode that runs on any system with a JVM. - WebAssembly compilers (code runs on any browser or OS).
- NET compiler (IL code runs on Windows, Linux, Mac).
- Java compiler (
![]()
0 Comments