Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
51 views29 pages

Compiler Construction (Week 01-Introduction)

The document outlines the course structure for Compiler Construction (CSC441) taught by Mian Muhammad Talha at COMSATS University Islamabad, detailing course credits, examination policies, and attendance requirements. It provides an overview of the course content, including compiler design, modules, and key topics such as lexical and syntax analysis. Additionally, it distinguishes between compilers and interpreters, and describes the phases of program execution.

Uploaded by

saJeelaKhan
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)
51 views29 pages

Compiler Construction (Week 01-Introduction)

The document outlines the course structure for Compiler Construction (CSC441) taught by Mian Muhammad Talha at COMSATS University Islamabad, detailing course credits, examination policies, and attendance requirements. It provides an overview of the course content, including compiler design, modules, and key topics such as lexical and syntax analysis. Additionally, it distinguishes between compilers and interpreters, and describes the phases of program execution.

Uploaded by

saJeelaKhan
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/ 29

Compiler Construction

(CSC441)

Week 01
Introduction to the course
MIAN MUHAMMAD TALHA
LECTURER
DEPARTMENT OF COMPUTER SCIENCE
COMSATS UNIVERSITY ISLAMABAD,
WAH CAMPUS
About Myself

OFFICE CS Faculty Hall

EMAIL [email protected]

Masters of Science in Computer Science (MSCS)

EDUCATION Bachelors of Science in Computer Science (BSCS)

COMSATS University Islamabad, Wah Campus

Full-Stack Software Quality Assurance Engineer


INDUSTRIAL EXPERIENCE
At National & International Firms

http://ww2.comsats.edu.pk/faculty/FacultyDetails.aspx
CUI WAH PROFILE ?Uid=31852

Created by Mian Muhammad Talha 2


About the Course (1/2)

03 Credit Hours (2-1)


CREDIT HOURS
02 Hours Theory + 03 Hours Lab / Week
04 as per CUI policy

QUIZES Unlimited as per my policy

Nature: Pre-announced / Surprise


04 as per CUI policy

ASSIGNMENTS Unlimited as per my policy

Nature: Pre-announced / Surprise


For Pre-announced Assignments
ASSIGNMENTS DEADLINE /
SUBMISSION Deadlines will not be comprised Submission through
CUOnline

Created by Mian Muhammad Talha 3


About the Course (2/2)

Mid Exam 25 Marks


EXAMINATIONS
Terminal Exam 50 Marks (marks may vary)

RECOMMENDATIONS No Favoritism, No Sifarish

06 Absentees as per CUI policy


ATTENDANCE
07 Absentees as per my policy (LIMIT)

Handle and Adjust Your Course Clashes On Your Own

No Compromise on Attendance

Created by Mian Muhammad Talha 4


SWITCH YOUR CELL PHONES TO
SILENT / VIBRATION MODE DURING
LECTURE

Created by Mian Muhammad Talha 5


Let’s Start With Your Introduction

___________________________
__
My CGPA, Hobbies, Life Goals are
___________________________
__
___________________________
I think in CC we will …….
__

Created by Mian Muhammad Talha 6


Layout

01 Course Outline

02 What is Compiler?

03 Difference between Compiler and


Interpreter
04 Program execution phases

05 Lecture Summary

06 Task # 01

Created by Mian Muhammad Talha 7


01.

Course
Outline

Created by Mian Muhammad Talha 8


Course Outline

Following are the main concerns of this course

How are compilers designed?

What are different modules of compilers?

Purpose of each module and working principle of each
module.

Implementation of each module in Lab.

Technology behind

Lexical analysis

Syntax analysis

Semantic analysis

Intermediate code representation

Code generation

Created by Mian Muhammad Talha 11


Textbooks:

• “Compilers: Principles, Techniques, and Tools” by “


Alfred V. Aho , Monica S. Lam , Ravi Sethi , Jeffrey D.
Ullman”
• “Introduction to Compilers and Language Design” by
“Prof. Douglas Thain ,University of Notre Dame”
• “Lex and Yacc: A Brisk Tutorial” by “Saumya K.
Debray ,Department of Computer Science The
University of Arizona
• Official PLY link https://www.dabeaz.com/ply/
YouTube + Google +
ChatGPT

Created by Mian Muhammad Talha 12


What is a
Compiler ?

Created by Mian Muhammad Talha 13


What• isA Compiler
a Compiler?
is a
program that
translates a
program in a source
language to a
program in a target
language.
• Typically, high to
low level language.
• Compiler also

Created by Mian Muhammad Talha


improve program
14
What a System software's
Compiler do?
which understand
both, what the
programmer and the
machine
understands. The
type of output is
sometimes referred
to as object code.
The outputted
machine code is
made up entirely of
binary bits -- 1s and
0s -- so it can be
read and executed
by the processors on
Created by Mian Muhammad Talha the target 15
How it works?

Created by Mian Muhammad Talha 16


Overview of a Compiler

Source Code Compiler Output Code

Errors/
Warnings
What are some of the Output
expectations we may
have from a good
compiler?
Created by Mian Muhammad Talha 17
Importance / features of a Compiler

• Speed of compiling code


• Accuracy of machine code
• Code should retain its meaning
• Rapid execution of machine code
• Effective error identification
• Accurate grammar checking for code
• Allows running high-level programming languages on
computer hardware
• Accelerates and simplifies software development
• Facilitates writing code once for use on various platforms
• Offers a level of abstraction for easier code readability,
writing, and maintenance
Created by Mian Muhammad Talha 18
Bonus for Loners

refers to the
degree of
excellence
or
“Compiler's
superiority friend, helps
code run, no waiting, but
in a product
line by line fun”
or service.

Created by Mian Muhammad Talha 19


Difference
between
Compiler
and
Interpreter
Created by Mian Muhammad Talha 20
What’s the difference?

Interpreter
ACompiler
compiler
translates code An interpreter
from a high-level translates code
programming written in a high-level
language (like programming
Python, JavaScript language into
or Go) into machine machine code line-by-
code completely line as the code runs.
before the program
runs.

Created by Mian Muhammad Talha 21


What’s
the
differenc
e?

Created by Mian Muhammad Talha 22


Program
Execution
Phases
Created by Mian Muhammad Talha 23
Program Execution Phases

Created by Mian Muhammad Talha 24


Program Execution Phases
(cont.)

refers to the
degree of
excellence
or
superiority
in a product
or service.

Created by Mian Muhammad Talha 25


Program Execution Phases
Skeletal (cont.)
Source Pre-processor A source program may be divided into
Program modules stored in separate files
Sou
rce
Pro
The compiler may produce an assembly- gra
m
language program as its output, because
Compiler
assembly language is easier to produce as m
rog ra
output and is easier to debug.
m b ly P
t Asse
e The assembly language is then
Targ
processed by a program called an
Assembler
assembler that produces
relocatable machine code as its
Program Execution Phases
Assembler Relocatable Object Code (cont.)
Linker

Large programs are often compiled in


pieces. The linker resolves external memory
addresses, where the code in one file may Absolute
refer to a location in another file. Machine
Code

Libraries and
Relocatable Object Files
The loader puts together all executable
object files into memory for execution

Created by Mian Muhammad Talha 27


Summary

Created by Mian Muhammad Talha 28


Task # 01 (Project
Initiation)
Make a GROUP of not more than 04 Members for
the semester project/presentation, discuss and set a
DECENT NAME for your group and share the details
with your CR.

CR has to prepare an Excel sheet which must


contain Four columns
Name & Name &
Registratio Registratio Group Laptop
n # of n # of Name Status
Student 01 Student 02
Anum
Ali Hassan
Asghar
SP20-BCS- CC Wizards Both Have
SP20-BCS-
034
041
Created by Mian Muhammad Talha 29

You might also like