Viz-Compiler

An Educational, Multi-Pass Compiler Built from Scratch

System Architecture

The Viz-Compiler is a custom language toolchain designed to visually demonstrate how high-level code transforms into raw hardware instructions. It targets the x86-64 System V ABI using a strict stack-based "Memory-to-Memory" model.

Our philosophy prioritizes correctness, stability, and observability over micro-optimizations like aggressive register allocation. Every phase of this compiler outputs observable artifacts.

Compilation Pipeline (Sub-Topics)

Explore each phase of the compiler. Each page contains deep architectural explanations and interactive simulators demonstrating the algorithms at work.

Phase 1

Lexical Analysis

Tokenizing raw text streams. Watch how the lexer discards whitespace and groups characters into meaningful compiler tokens.

Phase 2

Syntax Analysis (Parser)

Validating grammar and building the AST. Explore how operator precedence inherently shapes the execution tree.

Phase 3

Semantic Analysis

Scope resolution and Symbol Table generation. Discover how a compiler tracks types and validates return statements using a LIFO stack.

Phase 4

IR Generation

Flattening the AST into 3-Address Code (Quads). Learn how compiler temporaries bridge the gap between trees and assembly.

Phase 5

IR Optimization

Constant folding, propagation, and strength reduction. See how mathematical intelligence makes the generated code faster.

Phase 6

Code Generation

Translating Quads to Assembly and managing the RAM Stack to output valid x86-64 executable hardware instructions.

Reference

Language Reference

Comprehensive documentation for the VizLang syntax, semantics, and built-in functions.