4. 4
A Compiler is a program that Reads one
Language (Source Code) and Translate it into
an equivalent another Language (Target Code)
CompilerSource Code Target Code
5. 5
Source Code
usually in a high-level language,
e.g. C++, JAVA, VB, FORTAN, PASCAL, etc.
Target Code
usually in machine language (object code) or
assembly language (assembly code).
6. 6
Thus a Compiler specifically is an executable
program that Reads a source code written in
usually some high-level language and Translates it
into an equivalent object code (machine language)
or assembly code (assembly language)
Compiler
code in
high-level
language
outputExecutable program
in machine language
executable program
in machine code or
assembly code
input
Definition
13. Machine Language
With the advent of Stored Program Computer in
late 1940’s by John Von Neumann, it was time
To write Computer Programs (sequence of steps),
that needed a Compiler to interpret these
Programs.
Initially these programs were written in the actual
Machine Codes.
exp.
Task: move a number 2 to memory location 0000.
Machine Code Instruction c7 06 0000 0002
13
14. Programming was much difficult in such language
thus a symbolic language was introduced, and that
language is called Assembly Language
exp.
Task: move a number 2 to memory location 0000.
Machine Code Instruction: c7 06 0000 0002
Assembly Code Instruction: move x , 2
where x is symbolic memory location.
14
Assembly Language
16. The next step in programming was the advent of
high level languages, exp.
Task: move a number 2 to memory location 0000.
Machine Code Instruction: c7 06 0000 0002
Assembly Code Instruction: move x , 2
High Level Instruction: x = 2 ;
16
High Level Language
17. Machine Independency
Easy to Read (understand) & Write
Close to human nature
mathematically & logically
17
Advantages
18. FORTRAN (1954 - 1957)
FORTRAN was the first high level language
developed in 195- 1954
Thus the first compiler for FORTRAN was
developed by the team at IBM led by John Backus
between 1954 and 1957.
18
19. Noam Chomsky
When the first compiler was under construction
during 195- 1954, Noam Chomsky was working on
the structure of Natural Languages
Chomsky’s research work also helped the
construction of first compiler.
19
20. Chomsky Hierarchy
Chomsky classified the languages according to the
complexity of their grammar
These Hierarchies are;
Type 0
Type 1
Type 2
Type 3
Where each next type is an advance form of their
previous type.
20
21. Parsing Problem
The next step in the development of compilers
was the study of parsing problem during 1960 to
1970,
During that study CFL and the problem to find out
efficient algorithms for the recognition of CFL
were studied.
21
22. Recent Work
Currently scientists are continuously working and
trying to find efficient methods of object code
generation. Its really difficult to generate truly
optimal code, but they only increase its efficiency.
Similarly work is being on the automation of
different phases, i.e., scanner generators, parser
Generators, etc.
22
23. Recent Work
Scientists are also working to develop
different sophisticated algorithms for pre analysis
of source code, like Unification Algorithm
Development of more enhanced and rich window
based IDE’s
Standardization of such environments.
etc,
23
24. (1) for development of new languages.
- language extensions & improvement
- more rich/formal specification of languages
- development of 4th generation languages
(2) for Standardization of Construction Process.
(3) for parallelizing compilers & related tools.
(4) for new development platforms.
24
Importance
25. (5) theories learned in this course are applicable to
other fields
e.g.,
prototyping tools,
database languages
text formatter
FSM (Finite State Machine) translator
query interpreter
command line interpreter
interface programs
Silicon Compilers, etc.
(6) for improving capabilities of existing
compiler/interpreter
25
26. Silicon compiler
- A silicon compiler is a software system that takes a
user's specifications and automatically generates an
integrated circuit (IC). The process is sometimes
referred to as hardware compilation.
- Source language: conventional programming
language
- Variables
Represents not the location but logical signals (0 or 1)
or groups of signals in a switching circuit.
- Output : circuit design in an appropriate language
26