COURSE DELIVERY PLAN –LABORATORY
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING T :0
PROGRAM (UG/PG) : CSE P :3
Course Code : 1005233111 C : 1.5
Course Name : Compiler Design lab Date :08/06/2025
Regulation : VR23 Rev No : 01
Class Module Coordinator Section Name of the Faculty
[Link] CSE-A,B [Link]
III [Link]
I Sem Course Coordinator [Link] Laxmi
CSE-C,D
[Link]
COURSE OBJECTIVES:
To understand the concepts and implementation of compiler design for a basic language.
To apply Lex and Yacc tools for lexical and syntax analysis in compiler front-end design.
To learn and implement MIPS code generation techniques for simple programming
constructs.
Course Outcomes (COs):
CO1: Explain the phases of a compiler and understand the working of compilers such as GCC and
Clang. (K3)
CO2: Develop a lexical analyzer for a programming language. (K3)
CO3: Illustrate and implement a parser for a programming language.(K4)
CO4: Write three-address code for simple programming statements and expressions.(K3)
LIST OF EXPERIMENTS:
1. Check the output of different compilers gcc, g++, clang, clang++, javac, python etc by running
respective language programs with different flags. ( purpose to understand pre processor,
optimizations, linker)
2. The Language called TinyCStr is described as follows
i. Every TinyCStr program has one or more functions and syntax of function declaration and
function definition is similar to C, one function function must be main.
ii. Every TinyCStr function has zero or statements
iii. The possible statements are declaration, assignment, conditional statements (if,else, for, while)
except switch.
iv. TinyCStr supports primitive data types of C and a string datatype Implement a lexical analyser
for TinyCStr usingflex/lex Implement a parser for TinyCStr using bison/yacc and generate
AST(Abstract Syntax Tree) Generate a 3-address code from the AST Generate MIPS instructions
from 3-address code and run it on SPIM simulator
3. Write a program illustrating code optimization techniques:
i) Constant folding ii) Copy propagation iii) Common sub expression elimination iv) Loop
unrolling v) Dead code elimination
Teaching
[Link] Topics to be covered Reference
aids
Check the output of different compilers gcc, g++,
clang, clang++, javac, python etc by running
1 respective language programs with different flags. Lab manual page 2-5 BB
( purpose to understand pre processor, optimizations,
linker)
2. The Language called TinyCStr is described as
follows
i. Every TinyCStr program has one or more functions
and syntax of function declaration and function
definition is similar to C, one function function must
be main.
ii. Every TinyCStr function has zero or statements
iii. The possible statements are declaration,
2 assignment, conditional statements (if,else, for, while) Lab manual page 6-19 PPT
except switch.
iv. TinyCStr supports primitive data types of C and a
string datatype Implement a lexical analyser for
TinyCStr usingflex/lex Implement a parser for
TinyCStr using bison/yacc and generate AST(Abstract
Syntax Tree) Generate a 3-address code from the AST
Generate MIPS instructions from 3-address code and
run it on SPIM simulator
3. Write a program illustrating code optimization
techniques:
3 i) Constant folding ii) Copy propagation iii) Common Lab manual page 20-25 BB
sub expression elimination iv) Loop unrolling v) Dead
code elimination
Content beyond syllabus covered (if any):
C01: Implement Error Detection and Recovery in Parsing.
* BB- Black Board
* Session duration: 150 min
Mapping COs and POs:
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PSO1 PSO2
C01 3 2 2 2 3 - 2 2 2 - 2 2 2
C02 3 3 3 2 3 - - 2 - - 2 2 2
C03 3 3 3 3 3 2 - - 2 2 2 3 3
C04 3 3 3 3 3 2 2 2 2 2 2 3 3
Avg 3.00 2.75 2.75 2.5 3.00 2.00 2.00 2.00 2.00 2.00 2.00 2.50 2.50
Prepared by Signature Approved By Signature
MODULE
COORDINATOR
[Link]
HOD-CSE
PRINCIPAL