TinyC is a small, statically typed, C-shaped teaching language — int, float, bool and void types, arithmetic and logical operators, if/else, while, for, single-dimension arrays, and functions with parameters and recursion — and this project builds its complete compiler and virtual machine in Python 3.12. The pipeline is a classic two-pass design: the front end lexes, parses by recursive descent into an AST and runs semantic analysis with a scoped symbol table; the back end generates three-address code, lowers it to stack bytecode and executes it on a custom stack virtual machine with call frames.
The project is deliberately written from scratch — hand-written lexer, hand-written parser, hand-written VM — because the point is to make every phase of the dragon book (Aho, Lam, Sethi, Ullman) concrete and inspectable. Every stage can be run standalone: tinyc lex demo.tiny prints the token stream, tinyc parse dumps the AST, tinyc check lists semantic errors with line and column, tinyc compile emits three-address code and bytecode, and tinyc run executes the program on the VM.
What turns it from a code exercise into an M.Sc project is the measurement: a 70-program test corpus (40 valid, 30 invalid) pins down behaviour, and a benchmark suite (recursive Fibonacci, bubble sort on 1,000 elements, a prime sieve to 10,000) reports instruction counts and VM steps with and without the -O constant-folding pass. The dissertation quantifies what each phase costs and what the optimiser saves — numbers you can defend line by line in the viva.
- Relevant for
- Tamil Nadu
- Level
- Intermediate · 20 weeks · solo
- Common at
- University of Madras, Bharathiar University
- Updated
- Nov 2026