













































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of Compiler Design, including Language Processors, Structure of Compiler, Compiler Construction tools, Science of building a compiler, Applications of compiler technology, Basics of lexical analysis, and Syntax Analysis. It also covers the topics of Intermediate Code generation, Code Optimization, and Code Generation. the difference between compilers and interpreters, and the advantages and disadvantages of each. It also discusses the concept of high-level languages, pre-processors, assembly languages, and relocatable machine code.
Typology: Slides
1 / 53
This page cannot be seen from the preview
Don't miss anything!
Text book: Compilers, Techniques, and Tools
(Second Edition), Aho, Lam, Sethi, and
Ullman, Addison-Wesley, Pearson education,
Ref:https://nptel.ac.in/downloads/106108113/
can be used to make software reliably, securely, and efficiently
https://golang.org) and Clojure ( https://clojure.org/)
tools
parallelism and concurrency
depth an advanced topic in programming languages and
compilers of your own choosing.
Compiler Design 7th Sem BE(CSE) NMIT 5
can be called by the user to process inputs producing outputs.
Source program
Compiler
Errors
Target Program
Input
Target Program
Output
Running the
target program
Source program
Interpreter
Errors
Output
Input
in the source program on inputs supplied by the user.
error
diagnostics
diagnostics
& interpretation
Translator
Virtual
Machine
Source program
(byte code) Intermediate program
Input
Output
Compiler Design 7th Sem BE(CSE) NMIT 8
which are processed before
compilation are known as
preprocessor statements. Any
preprocessor statement begins with
#.modifies the source program.
Contains code with no
preprocessing statements. Collects
modules of source program from
files, expands shortcuts, & macros.
Includes corresponding function
definition.eg-file
include(#include),macro(#define PI
3.14)
source program and produces
assembly language program.
machine code as its output.
Note:
Fahrenheit and
centigrade are
lexemes
mapped into
tokens <id,1>
and <id,2> resp.
*is a lexeme
mapped to
token
or <*>
expression specifications
Grammars are Used for Specifying Syntax
The grammar S → aSbS | bSaS | ε generates all strings of a ’s and b ’s
with the same number of a ’s as b ’s.
This grammar is ambiguous: abab has two parse trees.
a
b S a S ε
S b S
ε ε
( ab )
n has parse trees
n
n
n
ε a S b S
a S b S
ε ε
Programming Languages are not
Inherently Ambiguous
This grammar G generates the same language
S → aAbS | bBaS | ε
A → aAbA | ε
B → bBaB | ε
G is unambiguous and has
only one parse tree for
every sentence in L ( G ).
ε a A b S
a A b S
ε ε