Week 1 Lec 1 CC

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 26

1

Lahore Garrison University


CSC373-Compiler Construction
Week-1 Lecture-1
Semester-#5 FALL 2019

Prepared by:

Eisha Tir Razia


2
Instructor Contact Details

 Instructor Name: Eisha Tir Razia


 Course : CSC373- Compiler Construction
 Credit Hours: 3
 Office Location: CS-Female Staff Room
 Email: [email protected]
 Visiting Hours: Tuesday 11:00 am to 12:00 pm

Lahore Garrison University


3
Course Objectives

 To introduce students to the concepts underlying the design and implementation of


language processors. More specifically, by the end of the course, students will be able to
answer these questions:
 What language processors are, and what functionality do they provide to their users?
 What core mechanisms are used for providing such functionality?
 How are these mechanisms implemented?
 Apart from providing a theoretical background, the course places a special emphasis in
practical issues in designing language processors. Through labs and the assessed project,
students will learn to:
 Design and implement language processors in C/C++
 Use tools to automate parts of the implementation process.

Lahore Garrison University


4
Learning Outcomes

 Master using lexical analyzer and parser generator tools.


 Master building symbol tables and generating intermediate code.
 Master generating assembly code for a RISC machine.
 Master programming in Java.
 Be familiar with compiler architecture.
 Be familiar with register allocation.
 Be exposed to compiler optimization.

Lahore Garrison University


5
Books

 Text Book
 Compilers: Principles, Techniques, and Tools By Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman,
Contributor Jeffrey D. Ullman, Addison-Wesley Pub. Co., 2nd edition, 2006
 Reference Books
 Modern Compiler Design, by Dick Grune, Henri E. Bal, Ceriel J. H. Jacobs, Koen G. Langendoen,
John Wiley, 2000.
 Modern Compiler Implementation in C, by Andrew W. Appel, Maia Ginsburg, Contributor Maia
Ginsburg, Cambridge University Press, 2004.
 Modern Compiler Design by Dick Grune, Henri E. Bal, Ceriel J. H. Jacobs, Koen G. Langendoen,
2003, John Wiley & Sons.

Lahore Garrison University


6
Course Prerequisites

 Theory of Automata

Lahore Garrison University


7
Course Contents according to HEC

 Introduction to interpreter and compiler. Compiler


techniques and methodology; Organization of
compilers; Lexical and syntax analysis; Parsing
techniques. Types of parsers, top-down parsing,
bottom-up parsing, Type checking, Semantic
analyser, Object code generation and optimization,
detection and recovery from errors.

Lahore Garrison University


8
Course Contents

 Following contents will be covered throughout the semester in week wise lectures:
 Introduction to interpreter and compiler
 Compiler techniques and methodology
 Organization of compilers
 Lexical and syntax analysis
 Parsing techniques
 Types of parsers
 top-down parsing
 bottom-up parsing
 Type checking
 Semantic analyzer
 Object code generation and optimization, detection and recovery from errors.
Lahore Garrison University
9
Software Use

 C, C++, C#
 JAVA

Lahore Garrison University


10
Teaching Methodology:

 Lectures
 Written Assignments
 Semester Project
 Presentations

Lahore Garrison University


11
Course Assessment:

 Sessional
 Home Assignments
 Quizzes
 Project
 Presentations

 Mid Exam
 Final Exam

Lahore Garrison University


12
Evaluation and Awarding Marks
Criteria

Grading Policy

25 Mid
Final
Sessional
50

Lahore Garrison University


13
Compiler Construction

Lahore Garrison University


14
Preamble of lecture

 Compiler
 History of Compiler
 Why we study Compiler?

Lahore Garrison University


15
Lecture Outcomes

 Understanding related
 Compiler and its importance

Lahore Garrison University


16
Compiler Construction

 Two important things


 What is compiler?
 How the process of compilation can be carried out?

Lahore Garrison University


17
Compiler

 Compilers are basically “translators”

 a program that translates an executable program in


one language into an executable program in another
language

Lahore Garrison University


18
Compiler

 “Compiler is a program which takes one language


(source program) as input and translates it into an
equivalent another language (target language)”
 A compiler translates (or compiles) a program written
in a high-level programming language that is suitable
for human programmers into the low-level machine
language that is required by computers.

Lahore Garrison University


19

 Source Language Program: Classical FORTRAN, C, to a modern


language such as JAVA, C++

 Target Program: Output of a compiler can also be a verity of a form


such as another programming language, re-locatable object program,
assembly language and machine language of a micro processor.

Lahore Garrison University


20

 Inside compiler; Artificial Intelligence, Algorithms, Theory, Systems and


Architecture (Pipeline management, hierarchy management, instruction
set use), mathematics, Data Structures all these things come together.
 Means writing a compiler requires an understanding of almost all of the
major computer science subfields which makes it an excellent
“Capstone”
project.

Lahore Garrison University


21
Interesting Point

Lahore Garrison University


22
Isn’t it a solved problem?

 Machines are constantly changing


 Changes in architecture changes in compilers
 new features pose new problems
 changing costs lead to different concerns
 old solutions need re-engineering
 Changes in compilers should prompt changes in architecture
 New languages and features

Lahore Garrison University


23
History

Not exactly known the date but early 1950’s is assumed to be start
of appearance of compilers.
Mainly used for translating arithmetic formulas into machine
language.
1952 (Linker/Loader) by Grace Hopper for A-0 Programming
languages.
1957 first FORTRAN compiler launched that is consider to be started
in 1954 by John Backus & team
1960--- COBOL compiler for multiple architecture
1962--- First self-hosting compiler for LISP

Lahore Garrison University


24
Why study Compiler Construction?

 Curiosity
 Better understanding of programming language concepts
 Wide applicability
 Transforming ‘data’ is very common.
 Very useful data structure and algorithms
 Practical Application of “Theory”

Lahore Garrison University


25

Q&A

Lahore Garrison University


26
References

Compilers: Principles, Techniques, and Tools By Alfred V. Aho, Ravi Sethi, Jeffrey D.
Ullman, Contributor Jeffrey D. Ullman, Addison-Wesley Pub. Co., 2nd edition, 2006

Lahore Garrison University

You might also like