Educational MiniLang compiler that transpiles to JavaScript or Python, with a fully responsive web playground (HTML/CSS/JS) and a Python backend.
- Lexer → Parser → Type checker → Transpiler
- Targets: JavaScript and Python
- Responsive playground (desktop / tablet / mobile)
- CLI (
cli.py) and REST API (app.py) - Example programs and tests
fn name(params) -> type { ... }
let x: int = 10;
x = x + 1;
if (cond) { ... } else { ... }
while (cond) { ... }
print(value);
return value;
Types: int, bool, void
Operators: + - * / %, == != < <= > >=, and or not
pip install -r requirements.txt
python app.pyOpen http://127.0.0.1:5000.
python cli.py examples/hello.ml -t javascript
python cli.py examples/recursion.ml -t python -o out.py
python cli.py examples/loops.ml --dump-astpip install pytest
pytest -qminilang/ # compiler core
lexer.py
parser.py
ast.py
sema.py
transpile.py
compiler.py
templates/ # HTML UI
static/css|js # responsive frontend
examples/ # .ml sample programs
app.py # Flask playground + API
cli.py # command-line transpiler
| Endpoint | Method | Body | Purpose |
|---|---|---|---|
/api/compile |
POST | { "source", "target" } |
Transpile |
/api/run |
POST | { "source" } |
Compile to Python & execute |
/api/examples |
GET | — | List examples |
What you got Compiler pipeline: lexer → parser → type checker → transpile Targets: JavaScript and Python Responsive UI: HTML/CSS/JS playground (desktop / tablet / mobile) CLI + Flask API + 8 examples + 8 passing tests Run it
pip install -r requirements.txt python app.py
Then open http://127.0.0.1:5000
python cli.py examples/hello.ml -t javascript python cli.py examples/recursion.ml -t python -o out.py pytest -q
Try in the UI Pick an example (or write MiniLang) Choose JavaScript or Python Transpile / inspect Tokens & AST Run to execute via the Python sandbox