Compiler Intro Lecture
Compiler Intro Lecture
Compiler Intro Lecture
1 / 18
Mode of Assessment
●
Three (3) major assignments – 20 Marks
●
Three Quizzes – 20 Marks
●
Mid – Semester Exams (1) – 15 marks + 5 marks from Quizzes
●
Attendance – 10 Marks
●
Main Exams – 30 Marks
Reading Material
– A Practical Approach to Compiler Construction. Des Watson (2017), Springer.
– Compilers Principles, Techniques, & Tools, by A.V. Aho, R.Sethi & J.D.Ullman, Pearson
Education
– Principle of Compiler Design, A.V.Aho and J.D. Ullman, Addition – Wesley
2 / 18
Course Outline
●
Module-I :
– Introduction to Compiling,
– A Simple One-Pass Compiler,
– Lexical analysis
●
Module-II:
– Syntax Analysis,
– Syntax-Directed Translation
●
Module-III
– Type Checking,
– Run-Time Environments
●
Module-IV
– Intermediate Code Generation,
– Code generation and Optimization
3 / 18
Module I
Introduction to Compiling
4 / 18
1.0 INTRODUCTION OF LANGUAGE PROCESSING SYSTEM
5 / 18
1.0 INTRODUCTION OF LANGUAGE PROCESSING SYSTEM
Preprocessor
●
A preprocessor produce input to compilers.
●
They may perform the following functions.
– Macro processing: A preprocessor may allow a user to define
macros that are short hands for longer constructs.
– File inclusion: A preprocessor may include header files into the
program text.
– Rational preprocessor: these preprocessors augment older
languages with more modern flow-of-control and data
structuring facilities.
– Language Extensions: These preprocessor attempts to add
capabilities to the language by certain amounts to build-in
macro. 6 / 18
1.0 INTRODUCTION OF LANGUAGE PROCESSING SYSTEM
Compiler
●
Compiler is a translator program that translates a program
written in a source program (HLL) into an equivalent program in
(MLL) the target program.
●
An important part of a compiler is the error messaging system.
Structure of a Compiler
7 / 18
1.0 INTRODUCTION OF LANGUAGE PROCESSING SYSTEM
Compiler
●
Executing a program written in HLL programming language is
basically of two parts:
– the source program must first be compiled/translated into an
object program.
– Then the resulting object program is loaded into a memory and
executed.
●
LOADER AND LINK-EDITOR: Write short notes on these.
12 / 18
1.0 INTRODUCTION OF LANGUAGE PROCESSING SYSTEM
●
LOADER AND LINK-EDITOR: Write short notes on these.
13 / 18
1.0 INTRODUCTION OF LANGUAGE PROCESSING SYSTEM
●
LIST OF COMPILERS – Common Lisp compilers
– Ada compilers – ECMAScript interpreters
– ALGOL compilers – Fortran compilers
– BASIC compilers – Java compilers
– C# compilers – Pascal compilers
– C compilers – PL/I compilers
– C++ compilers – Python compilers
– COBOL compilers – Smalltalk compilers
–
14 / 18
2.0 TRANSLATOR
●
A translator is a program that takes as input a program written in
one language and produces as output a program in another
language.
●
Beside program translation, the translator performs another very
important role, the error-detection.
●
Any violation of the HLL specification would be detected and
reported to the programmer.
●
Important role of translator are:
– Translating the HLL program input into an equivalent ml
program.
– Providing diagnostic messages wherever the programmer
violates specification of the HLL
15 / 18
16 / 18
17 / 18
18 / 18