What is Mini-Compilador Educativo?
Mini-Compilador Educativo is a fully functional educational compiler designed to teach the fundamental concepts of compiler construction. Built for the Compiler course at ESIME Culhuacán (Group 5CM24), it provides a complete implementation of all major compilation phases from lexical analysis through code generation.Authors: Fidel Ruiz Diego and Sánchez Flores Luis Leonardo
Professor: Veloz Ortiz Efren
Institution: ESIME Culhuacán
Professor: Veloz Ortiz Efren
Institution: ESIME Culhuacán
Why This Compiler?
Complete Pipeline
Implements all six phases of compilation: lexical, syntactic, semantic analysis, IR generation, interpretation, and code generation
Educational Focus
Extensively commented code with clear explanations makes it perfect for learning compiler design
Real Assembly Output
Generates actual x86 assembly code compatible with EMU8086 emulator
Dual Interfaces
Both CLI and GUI modes with syntax highlighting and live compilation
What Problems Does It Solve?
Traditional compiler courses often struggle with:- Abstract concepts: Compiler theory can be difficult to grasp without seeing it in action
- Large codebases: Production compilers are too complex for educational purposes
- Limited feedback: Students need to see each compilation phase’s output
- Setup complexity: Many compiler tools require complex build environments
- Providing clear, visible output at each compilation stage
- Keeping the codebase manageable (~2100 lines of well-documented Python)
- Including both text-based and visual representations of data structures
- Running with just Python 3.x - no complex setup required
Key Capabilities
Lexical Analysis (Scanner)
Converts source code into a stream of tokens:Syntactic Analysis (Parser)
Builds an Abstract Syntax Tree (AST) from tokens:Semantic Analysis
Validates logical correctness:- Checks for undefined variables
- Detects potential division by zero
- Warns about variable redeclaration
- Identifies self-referential assignments
Intermediate Representation
Generates three-address code (TAC):Interpreter
Executes programs directly without assembly:Code Generation
Produces x86 assembly for EMU8086:Who Should Use This?
Computer Science Students
Computer Science Students
Perfect for students taking compiler design courses who want to understand how compilers work by examining real, working code.
Educators & Professors
Educators & Professors
Provides a complete, teachable compiler implementation that can be used in lectures, labs, and assignments.
Self-Learners
Self-Learners
Anyone interested in compiler construction can study this codebase to learn the fundamental techniques.
Programming Language Enthusiasts
Programming Language Enthusiasts
Developers interested in creating their own programming languages can use this as a reference implementation.
The Compiler Workflow
Write Source Code
Create a program using the simple imperative language syntax with
let and print statementsQuick Example
Here’s a complete program and its compilation:- Source Code
- Execution Output
- Generated Assembly
Next Steps
Installation
Set up Python and install the compiler
Quick Start
Compile your first program in minutes
Architecture
Understand how the compiler is structured
API Reference
Explore the compiler’s classes and methods