CDC Unit - 1
CDC Unit - 1
COMPILER
▪A program that takes as input a program written in one
language (source language) and translates it into a
functionally equivalent program in another language (target
language)
▪Source – Usually high level languages like C, C++, Java
▪Target – Low level languages like assembly or machine code
▪During translation – Also reports errors and warnings to help
the programmer
Prepared by Sherin Joshi
Prepared by Sherin Joshi
Prepared by Sherin Joshi
APPLICATION AREAS
▪The techniques used in compiler design can be applicable to
many problems in computer science
▪Techniques used in a lexical analyzer can be used in text
editors, information retrieval system, and pattern recognition
programs
▪Techniques used in a parser can be used in a query processing
system such as SQL
▪Linker/Loader
▪If the target program is machine code, loaders are used to
load the target code into memory for execution
▪Linkers are used to link target program with the libraries
Prepared by Sherin Joshi
PHASES OF COMPILING
▪Two main phases of compiling process
▪Analysis
▪Synthesis
▪Analysis
▪Breaks up the source program into pieces and creates a
language independent intermediate representation of
program
▪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
Prepared by Sherin Joshi
PHASES OF COMPILING
▪Synthesis
▪Constructs the desired target program from the intermediate
representation and the information in the symbol table
▪The analysis part is often called the front end of the compiler
▪The synthesis part is the back end
● One-pass/Multi-pass compiler
https://pages.cs.wisc.edu/~fischer/cs536.s08/course.hold/html/NOTES/1.OVERVIEW.html