A lightweight expression language interpreter written in Rust.
- Arithmetic expressions with
+,-,*,/ - Variable assignment
- Parentheses for grouping
- Interactive REPL
- File execution mode
cargo build --releaseRun without arguments to enter the interactive interpreter:
cargo runExample session:
> x = 10
> y = 20
> x + y
30
> (x + y) * 2
60
Run a .pyoxide file:
cargo run -- example.pyoxideExample example.pyoxide:
radius = 5
area = 3.14 * radius * radius
area# Variable assignment
x = 10
# Expressions
y = x + 5 # addition
z = y - 3 # subtraction
result = z * 2 # multiplication
frac = result / 4 # division
# Parentheses
value = (x + y) * (z - 1)
# Print by evaluating
x + yLexer --> Parser --> Interpreter
- Lexer: Tokenizes input source code
- Parser: Builds AST from tokens
- Interpreter: Evaluates expressions
MIT