2 releases
0.1.1 | Aug 13, 2022 |
---|---|
0.1.0 | Aug 13, 2022 |
#595 in Programming languages
18KB
428 lines
Mink
The scripting language for all
Mink is a fast, simple and modular scripting language built on top of Rust. While it was originally targeted as a language for game engines, it now lives as a general-purpose language for any project.
Simple
Mink's syntax is simple, clear and explicit. On the user-end, it allows for dynamic typing and fast prototyping.
Developer-friendly
On the developer-end, Mink focuses on providing a simple but powerful API. Mink is completely modular as a language, allowing developers to implement their own libraries with ease (even the standard library!).
Example: Greet
print("Hi, Diego!")
use mink::*;
fn main() {
let mut vm = Mink::new();
let script = Script::new("greeting", include_str!("greeting.mink"));
vm.add_script(script);
vm.exec("greeting");
}
Example: Custom Library
// mathlib.rs
use mink::*;
pub fn lib() -> Library {
let mut lib = Library::new("math", true);
lib.add_func(Function::new("mag", Some(2), math_mag));
lib
}
fn math_mag(_: &Mink, args: Vec<Value>) -> Value {
let x = args[0].num();
let y = args[1].num();
Value::Num((x * x + y * y).sqrt())
}
// main.rs
mod mathlib;
use mink::*;
fn main() {
let vm = Mink::new();
vm.add_lib(mathlib::lib());
}
Dependencies
~2.1–4.5MB
~72K SLoC