0% found this document useful (0 votes)
6 views

Compiler Lect 1

Uploaded by

Laraib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Compiler Lect 1

Uploaded by

Laraib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

COMPILERS

PRINCIPLES,
TECHNIQUES, & TOOLS
INTRODUCTION
 Programming:
 Programming languages are notations for describing computations to people and to machines.
 all the software running on all the computers was written in some programming language.
 Program must be translated into a form in which it can be executed by a computer.
The software systems that do this translation are called compilers.
LANGUAGE PROCESSER
 1- Compiler
 Compiler is a software which converts a program written in high level language to low level
language. OR
 A compiler is a program that can read a program in one language (the source language) and
translate it into an equivalent program in another language (the target language).
 if the target program is an executable macchine-language program, it can then be called by the
user to process inputs and produce outputs
2-INTERPRETER
 An interpreter is another common kind of language processor. Instead of producing a target
program as a translation, an interpreter appears to directly execute the operations specified in
the source program on inputs supplied by the user.
3- HYBRID COMPILER
 combine compilation and interpretation
 For Example:
LANGUAGE TRANSLATOR
 Divided into four parts.
1- PREPROCESSOR DIRECTIVE
2- COMPILER
 Pure HLL is converted into Assembly Language Code.
3-ASSEMBLER
4- LINKER/ LOADER
THE STRUCTURE OF A
COMPILER
 Two parts of Compiler
 Analysis
 Synthesis
1-Analysis :
 The analysis part breaks up the source program into pieces and imposes a grammatical structure on
them.
 If the analysis part detects that the source program is either syntactically ill formed or semantically
unsound, then it must provide messages, so the user can take corrective action.
 The analysis part also collects information about the source program and stores it in a data
structure called a symbol table, which is passed along with the intermediate representation to the
synthesis part.
 The analysis part is often called the front end of the compiler
2- SYNTHESIS:
 constructs the desired target program from the intermediate representation and the information
in the symbol table.
 the synthesis part is the back end.
SYLLABUS
 Introduction
 Lexical Analysis
 Syntax Analysis
 Semantic Analysis
 Intermediate Code Generation
 Code Optimization
PREREQUISTIES &
REFERENCE MATERIAL
 Theory of Computation
 Computer Architecture

• Compilers: Principles, Techniques, and Tools, A. V. Aho, R. Sethi and


J. D. Ullman, Addison-Wesley, 2nd ed., 2006
• 2. Modern Compiler Design, D. Grune, H. E. Bal, C. J. H. Jacobs, K.
G. Langendoen, John Wiley, 2003.
• 3. Modern Compiler Implementation in C, A. W. Appel, M. Ginsburg,
Cambridge University Press, 2004.

You might also like