Compiler Design Lab
Compiler design tools grouped by topic, so you can jump to the part your course covers; each module brings together tools and worked guides for assignments and exam practice.
1. Lexical analysis
Lexical analysis turns source text into tokens: explore compiler phases and the lexer’s symbol-name table with the tools, and use the bootstrapping and error-handling guide for compiler context.
2. Parsing
Parsing checks how tokens fit a grammar: use the tools and worked guides to explore ambiguity, grammar rewriting, FIRST/FOLLOW, predictive, recursive-descent, LR and operator-precedence parsing, with CNF and CYK as related grammar practice.
Parse Tree Generator and Ambiguity Checker
Draw parse trees and see leftmost and rightmost derivations
Left Recursion and Left Factoring Calculator
Remove left recursion and left factor a grammar step by step
FIRST and FOLLOW Calculator
Find FIRST and FOLLOW sets for a grammar
LL(1) Parser
Build an LL(1) table, check conflicts and trace a parse
Recursive Descent Parser Generator
Generate a C or Python recursive descent parser from a grammar
LR Parser (LR(0), SLR, LALR, CLR)
Build LR parsing tables and trace shifts and reductions
Operator Precedence Parser
Build precedence tables and trace how a string is parsed
CFG to CNF Converter
Convert a grammar to Chomsky normal form step by step
CYK Parser
Test a word with CYK and inspect the parse table and tree
- Ambiguous Grammar Examples With Parse Trees
- Left Recursion and Left Factoring Examples
- FIRST and FOLLOW Sets Example, Step by Step
- Recursive Descent Parser in C: Worked Example
- SLR Parsing Table Example With LR(0) Items
- LALR and CLR Parsing Table Worked Example
- LR(1) vs LALR(1) Parsing and Conflicts
- Operator Precedence Parsing: Worked Example
- Yacc Precedence and Associativity Explained
- CYK Algorithm Example with CNF Conversion
3. Syntax-directed translation and intermediate code
Syntax-directed translation attaches computations to grammar rules: use the annotated-tree, infix conversion and intermediate-code tools to inspect attributes, syntax trees, DAGs, triples and quadruples, with the three-address-code guide for worked examples.
4. Run-time environments
Run-time environments organize procedure calls and storage: use the activation-record tool to trace recursion, control/access links and parameter passing, plus the hash-table simulator for separate symbol-table practice; this module has no dedicated guide yet.
5. Optimization and code generation
Optimization improves intermediate code before target-code generation: use the tools for basic blocks, flow edges, natural loops, data-flow sets, local, loop and peephole optimizations, register allocation and target instructions, with the Boolean-minimization guide as related practice.
Basic Blocks and Flow Graph
Split three-address code into blocks and draw control flow
Data-Flow Analysis
Trace reaching definitions or live variables across code blocks
Code Optimizer
Step through optimizations of integer three-address code
Simple Code Generator
Turn three-address code into register-machine instructions
Other labs
Frequently asked questions
Which compiler design topics are covered?
Five topic modules: phases of a compiler and lexical analysis; parsing (ambiguity, left recursion, FIRST and FOLLOW, LL(1), recursive descent, LR(0), SLR, LALR and CLR, operator precedence); SDT and three-address code; activation records; and basic blocks, data-flow analysis, optimization and code generation.
Do the tools show the working or only the answer?
The working. The LR parser shows every item set, table entry and parse step, FIRST and FOLLOW show each set, and the SDT tool draws the annotated parse tree with every attribute value.
Can I check my own grammar or code?
Yes. Every tool loads a textbook example first; replace it with your own grammar, expression or three-address code and the result updates as you type.