Crate tin_lang

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

use tin_lang::parser::Parse;

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

let module = tin_lang::ast::Module::parse(source).unwrap();

let mut ir = tin_lang::ir::Ir::new();
ir.module(&module)?;
ir.check_types();

/*
let mut module = tin_lang::codegen::Codegen::new(&ir).compile();
let main = module.function::<tin_lang::codegen::module::Function0<u32>>("main").unwrap();

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

Re-exports

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

Modules

Abstract syntax tree definitions for Tin.
A JIT compiler implementation based on the IR.
Common error types and utilities.
Intermediate representation variables for the compiler and interpreter.
A parser for Tin code.

Structs

An instance of the Tin runtime.