编译技术1-2
编译技术1-2
The History of Programming Languages and Compilers 编程语言与编译器的历史
1. Early Computing: From Nothing to Machine Code 早期计算:从无到机器码 • First, there was nothing. (最初,什么都没有。)
• Then, there was machine code. (随后,出现了机器码。)
• Programs were written in binary/hexadecimal (程序用二进制/十六进制编写).
• Example: C7 06 0000 0002
(MOV x, 2 in machine
code).
• Then, assembly languages emerged. (接着,汇编语言出现。)
• Example: MOV x, 2
(more readable than machine
code).
• Problem: Programming was expensive (编程成本高昂).
• 50% of computer costs went into programming (50%的计算机成本用于编程).
2. The Birth of High-Level Languages 高级语言的诞生 (1) Early Programming Methods (早期编程方式) • Hard-wired programs (硬接线程序):
• Analytical Engine (分析机), ENIAC (电子数字积分计算机) used electro-mechanical switches (机电开关).
• Punched-card systems (打孔卡系统):
• Programs encoded as numbers (machine language) stored on cards.
• Example: Manchester Mark I, EDSAC (早期计算机).
(2) The First Compiler (第一个编译器) • 1952: Grace Hopper developed the first compiler (A-0 System).
• "Nobody believed that... computers could only do arithmetic."
1 | ◦ “没人相信……计算机只能做算术。” |
• Initially, all programming was done in assembly (最初所有编程都用汇编).
• Problem: Software costs exceeded hardware costs!
• 软件成本超过了硬件成本!
3. FORTRAN I: The First Successful Compiler FORTRAN I:第一个成功的编译器 • Developed by John Backus (IBM, 1954-1957).
• Goal: Translate high-level code (e.g., x = 2
) to
assembly.
• 许多人认为这不可能。
• Impact of FORTRAN I (FORTRAN I的影响)
• By 1958, >50% of all software was written in FORTRAN.
• Reduced development time from 2 weeks → 2 hours.
• Produced code almost as efficient as hand-written assembly.
• Huge influence on modern compilers.
1 | ◦ 现代编译器仍保留FORTRAN I的基本结构。 |
4. The 1960s: Language Explosion 1960年代:语言大爆发
Language | Contribution | Influence Today |
---|---|---|
APL | Array-based programming | Influenced MATLAB, NumPy |
SNOBOL | String manipulation | Inspired Perl, Python |
Simula 67 | First object-oriented language | Basis for C++, Java |
Algol 68 | Combined FORTRAN, COBOL, pointers | Influenced C, but deemed too complex |
1968: The "Software Crisis" (软件危机) • Problem: Languages were too complex (语言过于复杂).
• Solution: Simpler languages like Pascal, C.
5. The 1970s: Methodology & New Paradigms 1970年代:方法论与新范式 • Emphasis on structured/modular programming (结构化/模块化编程).
• Example: Pascal (Niklaus Wirth).
• Mid-1970s: Prolog (逻辑编程).
• Declarative programming (声明式编程).
• Late 1970s: Ada (U.S. DoD)
• Replaced >500 military languages.
6. 1980s-Present: Rise & Fall of Complexity 1980年代至今:复杂性的起伏
Era | Trend | Example |
---|---|---|
1980s | Complexity peaks | C++ (OOP + low-level control) |
1990s | Simplification | Java (C++ without pointers) |
2000s | Specialization | Python, JavaScript, HTML |
Key Takeaways (关键结论)
- Compilers enabled high-level programming (编译器使高级编程成为可能).
- FORTRAN I set the foundation (FORTRAN I奠定了基础).
- Languages evolve between complexity & simplicity (语言在复杂与简单间循环).
- Modern languages prioritize readability & specialization (现代语言注重可读性和专用性).
Summary Timeline (历史时间线)
Year | Milestone |
---|---|
1952 | Grace Hopper’s first compiler |
1957 | FORTRAN I (Backus) |
1967 | Simula 67 (OOP) |
1970 | Pascal (structured programming) |
1983 | C++ (Stroustrup) |
1995 | Java (simplified C++) |
2000s | Python, JavaScript (scripting dominance) |
"The history of programming is a fight against complexity." “编程的历史是与复杂性的斗争。”