Skip to main content

Overview

Mini-Compilador Educativo is a fully functional educational compiler designed to teach the fundamentals of compiler construction. It demonstrates all major compilation phases from lexical analysis to x86 assembly code generation, making it perfect for students and educators.

Quick Start

Get up and running with your first program in minutes

Architecture

Learn how the compiler works under the hood

Grammar Reference

Understand the supported language syntax

Examples

Explore real code examples and use cases

Key Features

Complete Compilation Pipeline

Full implementation of lexical, syntactic, and semantic analysis phases

Intermediate Representation

Three-address code (IR) generation for optimization opportunities

Built-in Interpreter

Execute programs directly without assembly for rapid testing

x86 Code Generation

Generate EMU8086-compatible assembly code from high-level source

Dual Interface

Both command-line and graphical interfaces with syntax highlighting

Error Detection

Comprehensive error reporting across all compilation phases

Compilation Phases

The compiler implements a complete pipeline that mirrors production compilers:
1

Lexical Analysis

Tokenizes source code into meaningful symbols using the Scanner class
2

Syntactic Analysis

Validates grammar and constructs an Abstract Syntax Tree (AST) with the Parser
3

Semantic Analysis

Checks for logical errors like undefined variables and division by zero
4

IR Generation

Creates three-address code intermediate representation for optimization
5

Interpretation

Optionally executes the program directly for immediate feedback
6

Code Generation

Produces x86 assembly code compatible with EMU8086 emulator

Supported Language

The compiler accepts a simplified imperative language with two main statement types:
let x = 10 + 5;
let y = x * 2;
print y;
The language supports:
  • Variable declarations with let
  • Arithmetic expressions (+, -, *, /)
  • Print statements for output
  • Parenthesized expressions for precedence control
This educational compiler is designed for ESIME Culhuacán’s Compiler course (Group 5CM24). It demonstrates production compiler techniques in a digestible format.

Getting Started

Installation

Install Python dependencies and set up your environment

Write Your First Program

Learn the language syntax and write your first compiler program

Use the CLI

Compile and run programs from the command line

Use the GUI

Explore the graphical interface with live compilation

Build docs developers (and LLMs) love