Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
************
Introduction
************
=================
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.
==========
Evaluation
==========
Allotment of points
~~~~~~~~~~~~~~~~~~~~~~
* Weelky assignments: 20points
* Mid-term paper and discussion in class: 40points
* End-of-semester exam: 40points
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
=================
A Simple Question
=================
Why do we have so many programming languages?
* `List of programming languages - Wikipedia `_
* The development of new languages continues to this day.
* These languages are different from each other, but how different?
.. _definition_of_language:
========================
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.
* :index:`syntax` --- how you write a program.
* :index:`semantics` --- what will happen when executiing a program
=====================
Differences in syntax
=====================
Character
~~~~~~~~~
* Unique symbols (cf. `APL `_ )
* Japanese characters (cf. `Mind `_ )
* Graphics instead of characters (cf. `ToonTalk `_ , `Viscuit `_ )
Grammar
~~~~~~~
There are languages called `Esoteric progarmming language `_.
* `Whitespace `_
* `Befunge `_
* `Piet `_
========================
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.
===============================
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)
=======================================
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
===================================================
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.