Compilers
off-line data | program -----> C ------> exec | output
- Lexical Analysis : 词法分析
- Parsing :语法分析
- Semantic Analysis :语义分析
- Optimization :优化
- Code Generation :代码产生器
Interpreters
program —–>
I --------> output
Data ——>
L | P | S | O |CG
The Economy of Programming Languages
- why are there so many programming languages?
why are there new programming languages?
- Programmer training is the dominant cost for a programming language.
- widely used language are slow to change.
- easy to start a new language.
- productivity > training cost.
- language adopted to fill a void.
- new languages tend to look like old language.
what is a good programming language?
- There is no universally accepted metric for language design.
Application domains have distinctive/conflicting needs.
- scientific computing => good FP、good arrays、operations on arrays、parallelism => formula translation
- business applications => persistence、report generation、data analysis =>SQL(the database query language)
- systems programming =>control of resources、real time constraints => C/C++
Cool Overview
- Classroom Object Oriented Language(COOL)
- Designed to be implementable in a short time
- give a taste of implementation of modern
- Abstraction
- static typing
- Reuse(inheritance)
- Memory management
- And more …
- A complete compiler
– Cool -> MIPS assembly language- in 5 programming assignments(PAS)
- Write a Cool program
- Lexical analysis
- Parsing
- Semantic analysis. plug compatible
- Code generation
- optimization