A language for humans and machines.
Tangu is a fast, general-purpose s-expression language that unifies application code (.tan), structured configuration (.data.tan), and composable UI & database DSLs (#shtml, #css, #svg, #sql).
curl -fsSL https://tangu.dev/install.sh | sh#pub
(def User (Struct
#String #{:min-len 2 :max-len 50} name
#(Array String) roles
))
(derive User Eq Clone To-JSON From-JSON)
#pub
#(Func User String)
(def describe-user (Func user
(let role (if (contains? user:roles "admin") "Admin" (else "Member")))
"${user:name} (${role}): ${(join user:roles ", ")}"
))
{
:name "tangu-service"
:version "0.32.0"
:server {
:host "127.0.0.1"
:port 8080
}
:targets [:native :jit :rust :js]
}
#pub
(def <status-card> (Func [title status]
#shtml [:article.tech-card
[:h3.type-title-m title]
[:span.mod-tag status]
]
))
#pub
(def styles #css [
[".tech-card" {
:background-color "var(--color-surface-container-low)"
:border "1px solid var(--color-outline-variant)"
:padding "20px"
}]
])
(use {await} /coro)
(use {query-one-strong} /postgres/client)
#pub
(def create-account (Func [pool #String email]
(await (query-one-strong
pool
#sql "INSERT INTO accounts (email) VALUES ($1) RETURNING id, email"
email
))
))
Why Tangu?
Designed from the ground up so application logic, data schemas, markup, and stylesheets share a single AST representation.
Homoiconic & agent-native
ASTEvery program, .data.tan manifest, #shtml UI tree, and #css stylesheet is a uniform s-expression AST with zero syntactic ambiguity—making macros, formatting, and AI code generation deterministic.
Gradual types & pattern matching
#TypePair REPL-driven dynamic ergonomics with lightweight gradual type annotations (#Int, #(Array String)), structural pattern matching (when), derivable traits, and fast static lints.
70+ standard library modules
@standardBatteries-included modules for HTTP/2 servers, full-stack /web/app routing, PostgreSQL & SQLite pools, ICU4X i18n, 128-bit SIMD vectors, cryptography, and AVIF/WebP/PNG/JPEG codecs.
Multi-target execution engine
Iterate instantaneously in development and compile to native machine code, Rust crates, or JavaScript modules in production.
| Backend | Command | Description |
|---|---|---|
| Bytecode VM | tangu run main.tan | Instant startup with 16-byte Value representation and flat SymbolId caches. |
| Cranelift JIT | tangu run --jit main.tan | In-memory native machine code lowered from Typed IR (TIR). |
| Native AOT | tangu compile --target native | Standalone ahead-of-time native executables. |
| Rust & JS | tangu compile --target rust|js | Transpiles TIR into idiomatic Rust crates or ES modules with source maps. |
Single-binary developer toolchain
The tangu CLI ships with everything needed to run, test, type-check, lint, format, benchmark, and document code.
| Command | Purpose |
|---|---|
tangu run / repl | Run scripts/packages or launch the interactive REPL with history and completion. |
tangu test / bench | Execute parallel #test suites (*.test.tan) and #bench benchmarks across optimization levels. |
tangu check / lint | Fast static type checking, symbol resolution, and lint rules with auto-fixes. |
tangu fmt / doc | Deterministic CST/AST formatter and instant CLI documentation lookup (tangu doc /fs). |
tangu doctor / upgrade | Verify environment health and self-upgrade the toolchain from tangu.dev. |
Documentation & standard library
Browse the progressive language tutorial or jump directly to any @standard module reference.
Language tutorial
arrow_forwardProgressive step-by-step guide from installation and s-expressions to structs, traits, pattern matching, and modules.
Prelude & core built-ins
arrow_forwardSpecial forms, universal sequence accessors, core types, arithmetic/bitwise operators, and derivable traits.
Collections & iteration
arrow_forwardLazy iterator combinators (/iter), sets (/set), sorted and unordered maps, vectors (/vec), and ring buffers.
Text, strings & localization
arrow_forwardString manipulation (/string), regular expressions (/regex), CommonMark (/text/cmark), HTML escaping, and ICU4X (/i18n).
System, filesystem & I/O
arrow_forwardFilesystem operations (/fs), buffered I/O (/io), path manipulation (/path), processes (/process), OS threads (/thread), and async coroutines (/coro).
Data, codecs & validation
arrow_forwardJSON encoding/decoding (/codec/json), URI encoding (/codec/uri), CSV tables (/csv), Base64 (/base64), and struct validation.
Time, date & scheduling
arrow_forwardHigh-precision clocks, civil dates, time zones, durations (/chrono), Gregorian calendars (/calendar/gregorian), and cron schedules (/cron).
Web, HTTP & CLI
arrow_forwardHTTP client/server (/http/*), full-stack web apps (/web/app/*), WebSockets, SHTML/CSS representation, and CLI argument parsing (/cli).
PostgreSQL & SQLite databases
arrow_forwardConnection pools, read/write replica routing, strong vs eventual consistency queries (/postgres/client), and embedded SQLite (/sqlite/client).
Security, hashing & cryptography
arrow_forwardSHA-256 and HMAC (/crypto), CSPRNG tokens, fast non-cryptographic hashes (/hash), JWT signing/verification (/jwt), and UUIDs (/uuid).
Mathematics, SIMD & image codecs
arrow_forwardTranscendental math (/math), statistics, 4x4 matrices (/mat), portable SIMD vectors (/simd), PRNGs (/rng), and AVIF/JPEG/PNG/WebP codecs.