Dash is a lightweight interpreted programming language written in Rust. It supports variables, arithmetic, control flow, functions, and return values — all powered by a custom grammar using Pest. Whether you're building a scripting engine, learning interpreters, or just having fun, Dash is a great place to start.
- ✅ Variables and arithmetic (
let x = 3 + 4) - ✅ Control flow:
if,while,break,continue - ✅ Functions with parameters and return values
- ✅ Print statements
- ✅ CLI support for running
.dashfiles - ✅ Custom grammar with Pest
git clone https://github.com/Pjdur/dash-lang.git
cd dashcargo runThis runs a default hardcoded script. To run a file:
cargo run -- examples/hello.dashOr build and run:
cargo build --release
./target/release/Dash examples/hello.dashlet x = 3 + 4
print(x)
let x = 0
while x < 5 {
print(x)
let x = x + 1
}
if x > 10 {
print("big")
} else {
print("small")
}
fn add(a, b) {
return a + b
}
let result = add(5, 7)
print(result)
while x < 10 {
let x = x + 1
if x == 5 {
continue
}
if x == 8 {
break
}
print(x)
}
src/main.rs— Entry point and CLIlang.pest— Grammar definitionContext,Expr,Stmt,Op— Core AST and runtime structuresbuild_expr,build_stmt,exec_stmt,eval_expr— Parser and interpreter logic
Create a file like examples/hello.dash:
fn greet(name) {
print("Hello")
print(name)
}
greet("World")
Then run:
cargo run -- examples/hello.dashAll core functions and data structures are documented with Rust-style /// comments. You can generate docs with:
cargo doc --openPull requests are welcome! If you’d like to add features (booleans, arrays, REPL, etc.), improve error handling, or optimize performance, feel free to fork and submit a PR.
MIT License. See LICENSE for details.
Built with ❤️ using Rust and Pest. Inspired by classic interpreter designs and educational language projects.