Skip to main content

Prerequisites

The Mini-Compilador Educativo requires Python 3.x and uses only standard library modules, making installation straightforward.

System Requirements

Python Version

Python 3.6 or higher

Operating System

Windows, macOS, or Linux

Disk Space

Less than 1 MB

Memory

Minimal (standard Python runtime)

Installation Steps

1

Verify Python Installation

First, check that you have Python 3.x installed:
python --version
You should see output like Python 3.8.10 or higher.
If Python is not installed, download it from python.org and install it before proceeding.
2

Download the Compiler

Clone the repository or download the source code:
git clone https://github.com/diego0109/Programas.git
cd Programas
Alternatively, download the ZIP file from GitHub and extract it.
3

Verify File Structure

Ensure you have the main compiler file:
ls compfinal.py
The file should be approximately 86 KB (~2115 lines).
4

Test the Installation

Run the compiler to verify it works:
python compfinal.py
You should see the graphical interface launch. If it opens successfully, the installation is complete!
On some Linux systems without a display server, the GUI may not launch. Use console mode instead (see below).

No Dependencies Required!

Unlike many compiler projects, this compiler uses only Python standard library modules. No external dependencies need to be installed!
The compiler uses these built-in Python modules:
  • enum - For token type enumeration
  • dataclasses - For AST node definitions
  • typing - For type hints
  • tkinter - For the graphical interface
  • sys, io, time - For system operations

Running the Compiler

GUI Mode (Default)

Simply run the script without arguments to launch the graphical interface:
python compfinal.py

Console Mode

For command-line usage (useful on servers or for automation), use the --consola flag:
python compfinal.py --consola

Troubleshooting

Error: python: command not found or python3: command not foundSolution: Install Python from python.org. On Windows, make sure to check “Add Python to PATH” during installation.
Error: ModuleNotFoundError: No module named 'tkinter'Solution: Tkinter should be included with Python, but some Linux distributions package it separately:
Ubuntu/Debian
sudo apt-get install python3-tk
Fedora
sudo dnf install python3-tkinter
Arch Linux
sudo pacman -S tk
Error: GUI window doesn’t appear or crashesSolution: If you’re on a headless server or don’t have X11, use console mode:
python3 compfinal.py --consola
Error: UnicodeEncodeError or garbled charactersSolution: The compiler automatically configures UTF-8 encoding, but if issues persist, set your terminal encoding:
Windows (PowerShell)
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Linux/macOS
export PYTHONIOENCODING=utf-8

Verify Installation

To confirm everything works, create a test file:
1

Create test.txt

Create a file named test.txt with this content:
let x = 5 + 3;
print x;
2

Run in console mode

python3 compfinal.py --consola
When prompted, paste the code above and press Ctrl+D (Linux/macOS) or Ctrl+Z then Enter (Windows).
3

Check output

You should see:
  • ✓ Lexical analysis complete with tokens
  • ✓ Syntactic analysis complete with AST
  • ✓ Semantic analysis complete
  • ✓ IR code generated
  • ✓ Program executed: 8
  • ✓ Assembly code generated
If you see this output, the compiler is working correctly!

Optional: EMU8086 Setup

To actually run the generated x86 assembly code, you’ll need the EMU8086 emulator:
1

Download EMU8086

Download EMU8086 from emu8086.com (Windows only)
2

Install EMU8086

Run the installer and follow the setup wizard
3

Export Assembly

In the compiler GUI, click the Export ASM button after compilation to save the .asm file
4

Load in EMU8086

Open the .asm file in EMU8086, assemble it, and run it to see the execution
EMU8086 is optional - the compiler includes a built-in interpreter for testing programs without assembly.

Next Steps

Quick Start

Compile your first program

Writing Programs

Learn the language syntax

Using the CLI

Master console mode

Using the GUI

Explore the graphical interface

Build docs developers (and LLMs) love