Learning Compiler 2 Language Design
Note
Programming Language Economics
Languages are adopted to fill a void
- Enable a previously difficult/impossible application
- Orthogonal to language design quality (almost)
Programmer training is the dominant cost
- Languages with many users are replaced rarely
- Popular languages become ossified
- Buteasytostartinanewniche…
Why So Many Languages
Application domains have distinctive and conflicting needs
Language Evaluation Criteria
Characteristic | Criteria 1 | Criteria 2 | Criteria 3 |
---|---|---|---|
Readability | Writeability | Reliability | |
Data types | * | * | * |
Abstraction | * | * | |
Type checking | * | ||
Exception handling | * |
History
Abstraction:
- Detached from concrete details
- Modes of abstraction:
- Via languages/compilers: Higher-level code, few machine dependencies
- Via subroutines: Abstract interface to behavior
- Via modules: Export interfaces; hide implementation
- Via abstract data types: Bundle data with its operations
Types:
- Originally, few types
- FORTRAN: scalars, arrays
- LISP: no static type distinctions
- Realization: Types help
- Allow the programmer to express abstraction
- Allow the compiler to check against many frequent errors
- Sometimes to the point that programs are guaranteed “safe”
- More recently
- Lots of interest in types
- Experiments with various forms of parameterization
- Best developed in functional programming
Reference
Slides: Language Design
Video: Compiler Stanford 2014