Overview
The Mini-Compilador Educativo can be run in console mode for quick testing and batch processing. This mode accepts code input directly from the terminal and displays compilation results in real-time.Starting Console Mode
Launch the compiler in console mode using the--consola flag:
Console mode is ideal for quick experiments and learning the language interactively.
Writing Code in Console Mode
Enter your program
Type or paste your code line by line. Each statement should end with a semicolon:
Submit with blank line
Press Enter on an empty line to compile and execute:
The compiler will immediately process your code.
Example Session
Here’s a complete example of using console mode:Command-Line Options
The compiler accepts several command-line flags:Launch in console mode instead of GUI mode
Default Behavior
When run without flags, the compiler launches the GUI:Controlling Output Display
In console mode, all output phases are displayed by default. The GUI mode allows selective display through checkboxes.
Phase 1: Lexical Analysis
Phase 1: Lexical Analysis
Lists all tokens extracted from the source code:
Phase 2: Syntax Analysis (AST)
Phase 2: Syntax Analysis (AST)
Shows the abstract syntax tree structure:
Phase 3: Semantic Analysis
Phase 3: Semantic Analysis
Reports semantic validation results:Or shows errors if found:
Phase 4: Intermediate Representation
Phase 4: Intermediate Representation
Displays three-address code (TAC):
Phase 5: Program Execution
Phase 5: Program Execution
Shows the program’s output:
Working with Multiple Programs
Console mode allows you to compile multiple programs in sequence:Compile second program
After the first compilation completes, the prompt returns:Enter your next program:
Handling Errors
When compilation errors occur, the compiler reports them and continues:Lexical Errors
Syntax Errors
Semantic Errors
Exiting Console Mode
There are three ways to exit:- Type 'salir'
- Ctrl+C
- EOF (Ctrl+D)
At the code input prompt, type:The compiler responds:
Tips for Effective Console Use
Prepare code externally
Write complex programs in a text editor, then paste into the console for quick testing.
Use comments
Comments (
//) help document your experiments:Test incrementally
Build programs gradually, testing each addition:Then add more:
Save successful programs
Copy working programs from the terminal to save them for later reference.
Console Mode vs GUI Mode
- Quick experiments
- Learning the language
- Batch testing
- Command-line workflows
- Automated scripts
- Writing longer programs
- Selective output display
- Saving and loading files
- Exporting assembly code
- Visual program editing
Next Steps
Using the GUI
Learn about the graphical interface for more advanced workflows
Interpreting Output
Understand what each compilation phase produces
Writing Programs
Review language syntax and best practices
Error Handling
Solve common compilation issues