0% found this document useful (0 votes)
5 views18 pages

Lecture 1 CC

The document provides an introduction and outline for a compiler construction course. It discusses the course objectives which are to teach the basic concepts of compilers and their components. It will cover topics such as lexical analysis, syntax analysis, parsing techniques, code generation and optimization. Students will implement a lexical analyzer and parser for a language like C++ or Java for the project. The course will be delivered through lectures, presentations, and a programming project.

Uploaded by

Abd ur Rehman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views18 pages

Lecture 1 CC

The document provides an introduction and outline for a compiler construction course. It discusses the course objectives which are to teach the basic concepts of compilers and their components. It will cover topics such as lexical analysis, syntax analysis, parsing techniques, code generation and optimization. Students will implement a lexical analyzer and parser for a language like C++ or Java for the project. The course will be delivered through lectures, presentations, and a programming project.

Uploaded by

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

Compiler Construction

(CS-636)

1
Outline

1. Introduction to the Course


1. Course Introduction
2. Course Objectives
3. Organization of the Course
4. Topics to be Covered
5. Pre-requisites & Evaluation
2. Introduction to Compiler
3. Summary

2
Introduction to the Course

Compiler Construction
CS-636

3
Course Introduction

 At the end of the course, students should


understand the overall structure of a
compiler, and will have the knowledge of the
significant details of a number of important
techniques commonly used. The language
features that raise challenges for compiler
builders are also introduced in this course.

4
Course Objectives

 To teach students the basic concepts of


compilers, their components and how they work
together
 To get lexical analyzer and syntax analyzer
implemented of any programming language,
most likely C++

5
Organization of the Course

 Theoretical
 This part will be covered through lectures delivered
with the help of slides during class meetings
 Presentation
 Students will be given a topic to prepare a brief
presentation. The presentation will be scheduled in the
later part of the semester
 Project
 Implementation of Lexical Analyzer and Parser of C++
OR Java will be required from the students

6
Topics to be Covered
 Compiler introduction
 Organization of compilers
 Background / Revision of Automata Concepts
 Lexical analysis
 Syntax analysis
 Parsing techniques
 Object code generation and optimization
 Detection and recovery from errors
 Advanced Topics

7
Pre-requisites & Evaluation

 Pre-requisites
 Automata Theory
 Computer Programming

 Evaluation
 Mid-term Exam 12%
 Quizzes, Assignments, & Project 8%
 Final Theory 20%
 Final Practical 20%

8
Introduction to Compiler

Lecture: 1

9
What is a Compiler?

Compiler is a tool:
 which translate notations from one system to

another, usually from source code (high level


code) to machine code (object code, target
code, low level code).

10
What is a Compiler? (Continue…)

 A computer program translates one language to


another
Source Compiler Target
Program Program

 A compiler is a complex program


 From 10,000 to 1,000,000 lines of codes
 Compilers are used in many forms of computing
 Command interpreters, interface programs

11
What is Involved in Compilers?

 Programming Languages
 Formal Languages
 Regular Expressions & Automata Theory
 Applications

Programming Languages ?
 We use natural languages to communicate
 We use programming languages to speak with
computers

12
Why Compiler?

 Writing machine language-numeric codes is time


consuming and tedious
C7 06 0000 0002
Mov x, 2
X=2
 The assembly language has a number of defects
 Not easy to write
 Difficult to read and understand

13
Brief History of Compiler
 The first compiler was developed between 1954 and
1957
 The FORTRAN language and its compiler by a team at
IBM led by John Backus
 The structure of natural language was studied at about
the same time by Noam Chomsky
 Chomsky classified languages according to the
complexity of their grammar
 Chomsky’s Hierarchy, as it is now called have four levels
of grammar type 0, 1, 2, and 3
 The type 2 or context free grammar is considered the
most useful for programming languages

14
Brief History of Compiler (Continue…)
 Recent advances in compiler design
 More sophisticated algorithms for inferring and/or
simplifying the information contained in program,
 such as the unification algorithm of Hindley-Milner
type checking
 Window-based Interactive Development
Environment
 IDE that includes editors, linkers, debuggers, and
project managers
 However, the basic of compiler design have not
changed much in the last 50+ years
15
Files Involved in Compiler
Operations
 A source code text file (.c, .cpp, .java, etc. file
extensions)
 Intermediate code files: transformations of
source code during compilation, usually kept in
temporary files rarely seen by the user
 An assembly code text file containing symbolic
machine code, often produced as the output of a
compiler (.asm, .s file extensions)

16
Files Involved in Compiler
Operations
(Continue…)
 One or more binary object code files:
machine instructions, not yet linked or
executable (.obj, .o file extensions)
 A binary executable file: linked,
independently executable (well, not
always…) code (.exe, .out extensions, or no
extension)

17
Summary

Any Questions?

18

You might also like