ACSC373 – Compiler Writing
Chapter 3 – A Survey of High-level Languages
FORTRAN, COBOL, PL/I, BASIC, ALGOL (ALGOL 60, ALGOL W, ALGOL 68)
PASCAL, Concurrent Pascal, Modula-2, Ada
BCPL and C, C++
-
Functional Languages – LISP, APL
-
Logic Programming Languages – PROLOG
-
Other Language Types – Object-oriented languages
SIMULA 67
Smalltalk
String-processing languages
SLOBOL
Software packages
Interface languages – fourth-generation languages
One, two and three are associated with machine code, assembly languages and conventional high-level languages.
But why High-level Languages in a Compiler course?
The logic behind it is as follows: A compiler is a program that translates a high-level program into machine language. We are going to investigate how this is done…
And thus, bridge the gap between the writing of programs in a high-level language and their execution on a machine.
However, in order to bridge this gap we have to define both the source (high-level) and target (low-level) languages, and understand enough about the target language to be able to express high-level notions in them.
Exercises
-
Compare the different high-level languages and distinguish between imperative, functional, logic programming languages and other language types.
-
What are the relative merits in having a database package controlled by
-
function and procedure calls from a conventional high-level programming languages,
-
A special-purpose programming/command language, or
-
A menu-driven system?
Reasons for studying compilers
There are a number of reasons. There is the reason of the intellectual bridge between high-level and low-level languages, which should remove some of the mystery between high-level solutions to problems and their implementation on relatively simple hardware. There are also a number of other reasons.
Need for a formal notation to describe the source languages used.
i.e. proper definitions are essential where automated processing is involved.
e.g. syntax diagrams, or
grammars (easier to input to a computer, and tools have been developed to process grammars to produce compilers)
Actually, a very strong correspondence between syntax diagrams and grammars.
Therefore, from the study of formal definitions comes a better understanding of programming languages (e.g. in order to compile control constructs (if, while, for) you really have to understand how they work).
Concluding, the writing of compilers is useful as a vehicle for learning about programming and languages. Most programmers have a reasonable working knowledge of at least one language, which means that techniques can be related to a known area. The techniques used in writing compilers are of general applicability.
Share with your friends: |