1 unstable release

0.1.0 Jan 21, 2025

#370 in Programming languages

Download history 83/week @ 2025-01-19 7/week @ 2025-01-26 9/week @ 2025-02-02

99 downloads per month

LGPL-3.0

230KB
977 lines

Contains (ELF lib, 185KB) lib/libklein.so

cklein

Rust bindings to the Klein scripting language.

Usage

Add cklein to your project:

cargo add cklein

It can be used to run, tokenize, and parse Klein code; For example:

fn main() -> Result<(), cklein::RuntimeError> {
	cklein::run!(r#"
		for number in 1.to(100) {
			if number.mod(3) == 0 and number.mod(5) == 0 {
				print("FizzBuzz");
			} else if number.mod(3) == 0 {
				print("Fizz");
			} else if number.mod(5) == 0 {
				print("Buzz");
			} else {
				print(number);
			}
		}
	"#)
}

Contributing

Bindings are automatically generated via bindgen from the klein.h header file; See the build file for more details.

Dependencies

~0.3–2.6MB
~53K SLoC