3 releases
new 0.1.2 | Apr 13, 2025 |
---|---|
0.1.1 | Apr 12, 2025 |
0.1.0 | Apr 12, 2025 |
#215 in Programming languages
116 downloads per month
115KB
2.5K
SLoC
# RELO
A custom-built programming language interpreter and compiler written in Rust, designed to resemble simple English-like syntax such as:
VARIABLE x IS 10;
x ASSIGN x + 1;
DISPLAY "Hello";
WHEN condition { ... } OTHERWISE { ... } DONE;
CREATE FUNCTION myfunc { ... } END_FN;
## ๐ Features
- โ
Custom syntax with human-readable keywords (like
IS
,ASSIGN
,DISPLAY
,START
,END
) - โ
Support for:
- Variable declarations and assignment
- Conditionals (
WHEN
,OTHERWISE
) - Loops (
REPEAT
,LOOP
,QUIT
) - Functions (
CREATE FUNCTION
,CALL
,RETURN
)
- โ
Two execution modes:
- Tree-walk interpreter
- Bytecode compiler + virtual machine
- โ Rust-powered lexer, parser, and runtime
- โ
Benchmark-ready with
cargo run --release
๐ Project Structure
.
โโโ lexer/ # Tokenizer for custom keywords and literals
โโโ parser/ # Builds AST from tokens
โโโ interpreter/ # Tree-walk interpreter
โโโ compiler/ # Compiler to bytecode
โโโ vm/ # Stack-based virtual machine
โโโ main.rs # Program entry point
โโโ README.md
**๐งช Example Program**
START
VARIABLE i IS 1;
LOOP i Start 1 End 5 {
DISPLAY i;
i ASSIGN i + 1;
} DONE;
END
Edit
START
VARIABLE i IS 1;
LOOP i Start 1 End 5 {
DISPLAY i;
i ASSIGN i + 1;
} DONE;
END
**๐ Running the Project
๐ง Debug (for development)**
cargo run
**โก Release (optimized for speed)**
bash
cargo run --release
๐ Measure performance
Execution time is printed automatically after the program finishes.
**โ๏ธ Author**
Abdul Mubarak H
๐ง abdulmubarak682@gmail.com
****๐ License****
MIT License โ Free to use, modify, and distribute.
---
Would you like me to:
- Add badges (build status, language, license)?
- Create sample test files?
- Include contribution or usage guidelines?
Let me know and I can customize it even further!
Dependencies
~4โ10MB
~98K SLoC