Chennai Institute of Technology — Department of Computer Science & Engineering Lab manual: CS4501 — Compiler Design (July–December 2026)
All experiments use FLEX (lexical analysis) and BISON (parsing), compiled with gcc on
Linux. Each experiment folder is self-contained with its own AIM, algorithm, pseudocode, source
files, and sample output.
| No. | Title | Folder |
|---|---|---|
| 1 | Lexical analyzer to recognize patterns in C + symbol table | Experiment-01-Lexical-Analyzer-Symbol-Table |
| 2 | Lexical analyzer using LEX Tool | Experiment-02-Lexical-Analyzer-LEX-Tool |
| 3 | Recognize a valid arithmetic expression (+, -, *, /) | Experiment-03-Valid-Arithmetic-Expression |
| 4 | Recognize a valid variable (letter followed by letters/digits) | Experiment-04-Valid-Variable-Recognition |
| 5 | Recognize valid control structure syntax of C | Experiment-05-Control-Structures-Syntax |
| 6 | Calculator using LEX and YACC | Experiment-06-Calculator-LEX-YACC |
| 7 | Generate three-address code using LEX and YACC | Experiment-07-Three-Address-Code |
| 8 | Type checking using LEX and YACC | Experiment-08-Type-Checking |
| 9 | Code optimization (constant folding, strength reduction, algebraic simplification) | Experiment-09-Code-Optimization |
| 10 | Compiler back-end: TAC to 8086 assembly code | Experiment-10-Backend-8086-Assembly |
Most experiments follow this pattern (filenames vary per experiment — see each README):
flex <name>.l
bison -d <name>.y
gcc lex.yy.c <name>.tab.c -o <name> -lfl
./<name>Experiments 1 and 2 only use FLEX (no BISON):
flex <name>.l
gcc lex.yy.c -o <name> -lfl
./<name> <input-file># Debian/Ubuntu
sudo apt-get install flex bison gcc
# WSL / most Linux distros use the same commands aboveCS4501-Compiler-Design-Lab/
├── README.md
├── Experiment-01-Lexical-Analyzer-Symbol-Table/
│ ├── README.md
│ ├── symtab.l
│ └── input.c
├── Experiment-02-Lexical-Analyzer-LEX-Tool/
│ ├── README.md
│ ├── lexer.l
│ └── iplex.c
├── Experiment-03-Valid-Arithmetic-Expression/
│ ├── README.md
│ ├── art_expr.l
│ └── art_expr.y
├── Experiment-04-Valid-Variable-Recognition/
│ ├── README.md
│ ├── valvar.l
│ └── valvar.y
├── Experiment-05-Control-Structures-Syntax/
│ ├── README.md
│ ├── control.l
│ └── control.y
├── Experiment-06-Calculator-LEX-YACC/
│ ├── README.md
│ ├── cal.l
│ └── cal.y
├── Experiment-07-Three-Address-Code/
│ ├── README.md
│ ├── tac.l
│ └── tac.y
├── Experiment-08-Type-Checking/
│ ├── README.md
│ ├── typecheck.l
│ └── typecheck.y
├── Experiment-09-Code-Optimization/
│ ├── README.md
│ ├── optimize.l
│ ├── optimize.y
│ └── sample_input.txt
└── Experiment-10-Backend-8086-Assembly/
├── README.md
├── backend.l
├── backend.y
└── sample_input.txt