langkit 1.0.0-beta.2

A builder library for creating programming languages in Rust
Documentation

langkit

Langkit is a Rust builder library for creating programming languages with a simple, high-level API.

Status

This crate is in beta and evolving toward 1.0.0. The public API is intended to be stable, but minor changes may still happen before the final release.

Highlights

  • Built-in module packs via lang.lib("base") (math/io/fs/net/time/http).
  • File imports with module namespacing (import "utils.arc"utils.*).
  • Bytecode cache support and fast rebuilds.
  • Simple LSP diagnostics and minimal LSP server.
  • Tiny macro helpers: @include("file"), @repeat(n){...}.
  • REPL with history.

Goals

  • Minimal boilerplate for language definition.
  • Simple syntax rules with sensible defaults.
  • Optional static or dynamic typing.
  • Easy integration with Rust crates and FFI.

Quick Start

use langkit::{Lang, Typing, Value};

fn main() {
    let mut lang = Lang::new();
    lang.name("arc");
    lang.extension(".arc");
    lang.var("let");
    lang.mut_kw("var");
    lang.assign("=");
    lang.typing(Typing::Dynamic);
    lang.lib("base");

    lang.token("print");
    lang.action("print", Box::new(|args| {
        let s: Vec<String> = args.iter().map(|a| a.to_string()).collect();
        println!("{}", s.join(" "));
        Value::Null
    }));

    lang.run("let x = 5\nprint x").unwrap();
}

Documentation

Run:

cargo doc --open