Crate tin

source ·
Expand description

Tin is a simple embeddable programming language.

The aim is to have a very light-weight footprint and a simple API.

Examples

let source = r#"
pickFirst = |a: i32, b: i32| i32 {
  capture = |x: i32| i32 { a + x };
  capture(b)
};
main = || i32 { pickFirst(42i32, 62i32) };
"#;

let mut tin = tin::Tin::new();
tin.load("main.tn", source)?;

/*
let mut module = tin.compile()?;
let main = module.function::<tin::module::Function0<i32>>("main").unwrap();

let result = main();
assert_eq!(42, result);
*/

Re-exports

pub use crate::error::Error;
pub use crate::error::Result;

Modules

Utilities for producing human-readable diagnostics out of errors.
Common error types and utilities.
Graph rendering tools for the internal representation of Tin code.
Definitions for compiled modules.

Structs

An instance of the Tin runtime.