Lu is a lightweight pseudocode-to-Python compiler, currently supporting basic IGCE-style pseudocode. It uses Python’s built-in AST module to parse and translate pseudocode logic into Python code.
- Output Statements: Converts IGCE pseudocode
OUTPUT
commands to Python’sprint()
function. - Conditional Logic: Handles
IF
,ELSE
,ENDIF
, and nested conditional statements. - Variable Assignment: Supports variable declaration and assignment.
- Error Handling: Detects and reports syntax issues with details.
- Logging: Implements a logging system for debugging.
-
Write your IGCE pseudocode in a
.lu
file. -
Run the Lu compiler:
python lu/lu_compiler.py path_to_file/<filename>.lu
This will generate
<filename>.py
, a Python equivalent of your pseudocode.
For an input .lu
file:
IF x > 5 THEN
OUTPUT x
ELSE
OUTPUT "Value too low"
ENDIF
The compiler will output equivalent Python code.
Clone the repository:
git clone https://github.com/gsdev215/lu.git
Then navigate to the lu
directory and run the compiler as described.