Overview
The Mini-Compilador Educativo includes a full-featured graphical interface (InterfazCompilador) built with Tkinter. The GUI provides a complete development environment with syntax editing, compilation output display, and assembly export capabilities.
Launching the GUI
Start the GUI by running the compiler without arguments:- Source code editor (top panel)
- Compilation output viewer (bottom panel)
- Toolbar with compilation controls
- Status bar with metrics
The GUI is the default mode. Use
--consola flag only for console mode.Interface Tour
Window Layout
The interface is divided into four main areas:- Header
- Toolbar
- Code Editor
- Output Panel
Institution and Project InformationDisplays:
- School: Escuela Superior de Ingeniería Mecánica y Eléctrica - Unidad Culhuacán
- Course: Grupo 5CM24
- Professor: Veloz Ortiz Efren
- Students: Fidel Ruiz Diego y Sánchez Flores Luis Leonardo
Status Bar
The bottom status bar displays:- Sin compilación - No compilation yet
- Estado: Correcto - Last compilation successful
- Estado: Revisar errores - Last compilation had errors
Current or most recent action:
- “Compilando…” during compilation
- “Última compilación: OK en 45 ms”
- “Tema oscuro activado”
- “Ejemplo cargado”
Real-time code metrics:
- Líneas: Number of lines in editor
- Caracteres: Character count
Writing and Compiling Programs
Write your code
Type or paste code into the editor:The status bar updates to show line and character counts.
Choose output options
Select which compilation phases to display using checkboxes:
- ✅ Mostrar tokens - See lexical analysis
- ✅ Mostrar AST - See syntax tree
- ✅ Mostrar IR - See intermediate code
Disabling options reduces output verbosity but doesn’t affect compilation.
Compile
Click the Compilar button or press
Ctrl+Enter (Windows/Linux) / Cmd+Enter (macOS).The button disables during compilation and shows “Compilando…” in the status bar.Example Compilation Session
Using the Toolbar
Load Example
Click Cargar ejemplo to populate the editor with a sample program:Clear Functions
Limpiar editor
Removes all text from the code editor. Use when starting a new program from scratch.Shortcut:
Ctrl+L / Cmd+LLimpiar salida
Clears the compilation output panel. Useful when output becomes cluttered from multiple compilations.Resets status to “Sin compilación”.
Theme Toggle
Switch between light and dark themes:- Light Theme
- Dark Theme
Default appearance:
- White editor background
- Black text
- Light gray panels
- Blue accents
Exporting Assembly Code
Write valid code
Ensure your program compiles without errors. Assembly export requires successful compilation.
Generated Assembly Format
The compiler generates EMU8086-compatible x86 assembly:Keyboard Shortcuts
The GUI supports several productivity shortcuts:Compile program - Same as clicking “Compilar”
Clear editor - Remove all code from editor
Load example - Insert sample program
Toggle theme - Switch between light and dark modes
On macOS, use
Cmd key. On Windows/Linux, use Ctrl key.Understanding Output Colors
The output panel uses color coding:Successful completion of phases:
- ”✓ Completado: 15 tokens generados”
- ”✓ RESULTADO: ¡Compilación exitosa!”
Errors and failures:
- ”✗ Error léxico en línea 3…”
- ”✗ Error semántico…”
Phase headers and section titles:
- “[FASE 1] Análisis Léxico…”
- “TOKENS (resultado del análisis léxico)“
Working with Long Programs
The editor supports programs of any length:- Scrolling
- Line Numbers
- Resizable Panels
Both editor and output panels have:
- Vertical scrollbars for long content
- Horizontal scrollbars for wide lines
- Mouse wheel support
Error Handling in GUI
The GUI provides clear error feedback:Warning Dialogs
Empty code:Status Updates
Errors update the status bar:Best Practices
Save work frequently
Save work frequently
The GUI doesn’t auto-save. Copy your code to an external editor or file:
- Select all code (
Ctrl+A/Cmd+A) - Copy (
Ctrl+C/Cmd+C) - Paste into text editor
- Save file as
.txtor.comp
Use selective output display
Use selective output display
For iterative development, disable verbose output:
- Uncheck Mostrar tokens to hide lexical details
- Uncheck Mostrar AST to hide syntax tree
- Keep errors and execution results visible
Test incrementally
Test incrementally
Build programs gradually:
- Write a few lines
- Compile to verify correctness
- Add more functionality
- Compile again
Use themes for comfort
Use themes for comfort
Switch to dark theme (
Ctrl+T) when working in dim lighting to reduce eye strain.Window Controls
Resizing
Minimum window size: 980 × 640 pixelsDefault size: 1120 × 760 pixels Resize by dragging window edges. Layout adapts responsively.
Closing
Close the window to exit:- Click the window close button (X)
- No unsaved work warning (GUI doesn’t persist state)
Compilation Performance
The status bar shows compilation time:- Small programs (< 10 lines): 20-50 ms
- Medium programs (10-50 lines): 50-150 ms
- Large programs (> 50 lines): 150-500 ms
Times include all phases: lexical, syntactic, semantic analysis, IR generation, interpretation, and assembly generation.
Next Steps
Writing Programs
Learn the language syntax in detail
Interpreting Output
Understand each compilation phase’s output
Using the CLI
Try console mode for quick testing
Code Generation
Learn about the generated x86 assembly