Lightweight educational interpreter (C++) with Python-like syntax. Intended for learning lexer/parser/interpreter basics.
- Assignments and integer arithmetic (+, -, *, /)
- Conditionals (
if) and comparison (==,<,>) whileloopsprintstatements- Functions with parameters and
return - Indentation-based blocks (4 spaces per INDENT) and scoped variables
- Arrays with indexing and assignment
- Build (requires
g++on PATH):
./scripts/build_all.ps1- Run interpreter (optional filename argument):
./build/main.exe [path\to\script.txt]- Run test suite:
./build/run_tests.exe// Create an array with bracket notation
arr = [1, 2, 3, 4, 5]
// Access elements by index (0-based)
x = arr[0] // x = 1
y = arr[2] // y = 3
// Modify elements
arr[1] = 10 // arr becomes [1, 10, 3, 4, 5]
// Use in expressions
result = arr[0] + arr[1] // result = 11
// Print array elements
print arr[3] // prints 4- Function bodies use
{}braces;if/whileuse a colon and indented blocks. - The lexer emits one
INDENTper 4 spaces and warns on non-multiple-of-4 indentation. - Arrays can only contain integers and are passed by value to functions.
- Array indices must be valid (no bounds checking yet - accessing out of bounds is undefined behavior).
MIT (see LICENSE)