tiny
A compiler for the Tiny language that generates SSA-form intermediate representation with optimizations like common subexpression elimination and copy propagation.
Try it
Write Tiny code below and compile it to see the control flow graph.
Source code
Control flow graphLoading...
Loading compiler...
The Language
Tiny is a simple imperative language with:
- Variables and arithmetic expressions
- Control flow (
if/then/else/fi,while/do/od) - Functions with parameters and return values
- Built-in I/O (
InputNum,OutputNum,OutputNewLine)
The Compiler
The compiler pipeline:
- Lexer - Tokenizes source into a stream of tokens
- Parser - Builds an AST from the token stream
- IR Generator - Converts AST to SSA-form IR with phi functions
- Optimizations - CSE, copy propagation, dead code elimination
The visualization shows the control flow graph with basic blocks connected by edges (fall-through and branch). Each block contains SSA instructions with unique IDs.