A general-purpose, cross-platform, pure functional scripting language and document processing engine.
Built from scratch in C/C++ with a custom and light-weight runtime (only 6 MB), Tree-sitter parsing, MIR-based JIT compilation.
Note: Lambda Script is still evolving — syntax/semantics and implementation details may change. A stable subset of the literal data model is separately formalised and released as Mark Notation.
Lambda is designed for two things at once:
- a small, expressive functional language for transforming data and documents, and
- an end-to-end document pipeline (parse → normalize → validate/transform → layout → render/view).
Internally, Lambda treats documents as structured data. Different input formats (Markdown, Wiki, HTML/XML, JSON/YAML/TOML/CSV, LaTeX, PDF, …) can be parsed into a unified Lambda/Mark node tree, transformed with Lambda scripts, validated with schemas, and then rendered via the Radiant HTML/CSS/SVG layout engine.
- Pure-functional core with immutable data structures (lists, maps, elements) and first-class functions.
- Interactive REPL for exploration and debugging.
- Fast parsing with a Tree-sitter based frontend.
- Optional MIR JIT execution path for performance-sensitive workloads.
- Reference counting + pooled allocators for predictable memory behavior.
- Multi-format parsing: JSON, XML, HTML, Markdown, Wiki, YAML/TOML/INI, CSV, LaTeX, PDF, and more.
- One universal representation: parse disparate syntaxes into a common Lambda/Mark node tree.
- Conversion pipeline: convert between formats using
lambda convert(auto-detect input formats when possible). - Document-centric tooling: designed to treat “documents as data”, not just as text.
- Rich type system with type inference and explicit type annotations, similar to that of TypeScript.
- Schema-based validation for structured data and document trees (including element schemas for HTML/XML-like structures).
- Format-aware validation helpers that unwrap/normalize documents before validation.
- Detailed error reporting with paths and expected/actual diagnostics.
- Browser-compatible layout engine supporting block/inline flow, flexbox, grid, and tables.
- CSS cascade + computed style resolution, with pixel-ratio aware sizing.
- Render targets: SVG / PDF / PNG / JPEG output via
lambda render. - Unified interactive viewer via
lambda view:- HTML / XML (treated as HTML) with CSS styling
- Markdown / Wiki (rendered with styling)
- LaTeX (
.tex) via conversion to HTML - PDF viewing
- Lambda script results (
.ls) evaluated and rendered
- Download the Lambda binary for your platform from the GitHub Releases page, and unzip it.
- Run:
./lambda.exe view
Lambda is built from source. The dependency scripts also install Node.js/npm (used by Tree-sitter generation via npx).
macOS (native build):
./setup-mac-deps.shLinux (Ubuntu/Debian):
./setup-linux-deps.shWindows (native build under MSYS2):
./setup-windows-deps.shRecommended (Premake-based Make targets):
make build # Incremental build (default)
make debug # Debug build (AddressSanitizer enabled)
make release # Optimized release buildMore build help:
make helpThe build produces a runnable executable at the repo root: lambda.exe.
Show help:
./lambda.exe --helpInteractive REPL:
./lambda.exeRun a script:
./lambda.exe script.ls./lambda.exe <script.ls> # functional script
./lambda.exe run <script.ls> # procedural script
./lambda.exe validate <file> [-s <schema.ls>]
./lambda.exe convert <input> [-f <from>] -t <to> -o <output>
./lambda.exe layout <file.html|file.tex|file.ls> [options]
./lambda.exe render <input.html|input.tex|input.ls> -o <output.svg|pdf|png|jpg> [options]
./lambda.exe view [file.pdf|file.html|file.md|file.wiki|file.xml|file.tex|file.ls]Tip: ./lambda.exe <command> --help prints detailed options and examples.
-
Clone the repository:
git clone https://github.com/henry-luo/lambda.git cd lambda -
Install dependencies:
# macOS ./setup-mac-deps.sh # Linux ./setup-linux-deps.sh # Windows ./setup-windows-deps.sh
-
Build:
make build
// Parse JSON and convert to Markdown
let data = input("data.json", 'json')
format(data, 'markdown')
// Process CSV data
let csv = input("data.csv", 'csv')
for (row in csv) {
if (row.age > 25) row
}
λ> let data = input("sample.json", 'json')
λ> data.users.length
42
λ> for (u in data.users) { if (u.active) u.name }
["Alice", "Bob", "Charlie"]
make build-test
make testLambda uses a Premake5-based build system generated from build_lambda_config.json.
make build # Incremental build (recommended)
make release # Optimized release build
make clean # Clean build artifacts
make generate-grammar # Regenerate Tree-sitter parser (auto-runs when grammar changes)- Language reference:
doc/Lambda_Reference.md - Validator guide:
doc/Lambda_Validator_Guide.md - Radiant layout design:
doc/Radiant_Layout_Design.md - Mark doc schema (for lightweight markup, like Markdown, Wiki, RST, etc.):
doc/Doc_Schema.md
| Platform | Status | Notes |
|---|---|---|
| macOS | ✅ Full | Native development platform |
| Linux | ✅ Full | Ubuntu 20.04+ tested |
| Windows | ✅ Full | Native build via MSYS2; |
This project is licensed under the MIT License - see the LICENSE file for details.
- MIR Project: JIT compilation infrastructure
- Tree-sitter: Incremental parsing framework
- ThorVG: SVG vector graphics library
- GoogleTest: C++ unit testing framework
- Issues: GitHub Issues

