1. Introduction¶
1.1. About this course¶
Advanced subjects – for 3rd or 4th year students.
Aim: Theoretical understanding of programming languages.
Prerequisite: knowledge about two or more programming languages.
1.2. Evaluation¶
1.2.1. Allotment of points¶
Weelky assignments: 20points
Mid-term paper and discussion in class: 40points
End-of-semester exam: 40points
1.2.2. Distribution in the past years¶
year 2023(GIGA) — S:1, A:7, B:3, C:2, D:8
year 2024(Japanese) — S:17, A:15, B:6, C:5, D:11
1.3. A Simple Question¶
Why do we have so many programming languages?
The development of new languages continues to this day.
These languages are different from each other, but how different?
1.4. Definition of a language¶
When you want to define a new language, it is important that the definition is simple, rigorous and understandable.
Scheme gives a mathematically precise definition which is hard to understand.
BASIC and C had no rigid definitions at first. As a result, we had several slightly different language processors.
We need two things to define a language.
syntax — how you write a program.
semantics — what will happen when executiing a program
1.5. Differences in syntax¶
1.5.1. Character¶
1.5.2. Grammar¶
There are languages called Esoteric progarmming language.
1.6. Differences in semantics¶
Philosophically speaking, programming paradigm means “What is computation?”.
- Imperative (Procedural)
Computation is a sequence of changing state.
- Functional
Computation is a reduction of expression.
- Logical
Computation is a proof of proposition.
1.7. Differences in execution method¶
Two main mathods to execute a program:
- Compiler
A compier translates the whole program to machine code before execution.
- Interpreter
An interpreter reads the source code and execute the operation step by step.
Theoretically, a language and its execution method are independent. However, many languages are classified as either compiler languages or interpreter languages.
There are hybrid methods:
- Bytecode
Bytecode is a platform-independent form of program code that can be efficiently executed by an interpreter (often called Virtual Machine or VM). A compiler translates the source code to byte code and then executed by VM. (e.g. Java)
- Transpiler
A transpiler translates the whole program to another high-level language program. (e.g. TypeScript)
- JIT (Just-In-Time compiler)
JIT is a component attached to an interpreter that translates parts of the program to machine code during execution. (e.g. JavaScript)
1.8. Criteria for good programming languages¶
Readablility and writability are not compatible in general.
Efficiency
fast execution
fast compilation
fast development process
Reliability
Strong typing, forcing execption handling, etc. (However, some people don’t like them)
Other points
low learning cost
low development cost of language processors
abundant libraries
1.9. Reasons to study the theory of programming language¶
You can select a language suitable for a task in your hand. — There is a saying ‘If all you have is a hammer, everything looks like a nail’.
You can learn a new language easily. — You must continue to learn since progress of IT is very fast.
It is an important base of the computer science.