Tanguv0.32.0
Version 0.32.0 · Linux & macOSMPL-2.0

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).

One-line shell installation
sh
curl -fsSL https://tangu.dev/install.sh | sh
Application code & gradual types
#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 ", ")}"
))
Pure s-expression data manifests
{
    :name "tangu-service"
    :version "0.32.0"
    :server {
        :host "127.0.0.1"
        :port 8080
    }
    :targets [:native :jit :rust :js]
}
Composable SHTML & scoped CSS
#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"
    }]
])
Parameterized SQL & PostgreSQL pools
(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

AST

Every 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

#Type

Pair 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

@standard

Batteries-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.

BackendCommandDescription
Bytecode VMtangu run main.tanInstant startup with 16-byte Value representation and flat SymbolId caches.
Cranelift JITtangu run --jit main.tanIn-memory native machine code lowered from Typed IR (TIR).
Native AOTtangu compile --target nativeStandalone ahead-of-time native executables.
Rust & JStangu compile --target rust|jsTranspiles 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.

CommandPurpose
tangu run / replRun scripts/packages or launch the interactive REPL with history and completion.
tangu test / benchExecute parallel #test suites (*.test.tan) and #bench benchmarks across optimization levels.
tangu check / lintFast static type checking, symbol resolution, and lint rules with auto-fixes.
tangu fmt / docDeterministic CST/AST formatter and instant CLI documentation lookup (tangu doc /fs).
tangu doctor / upgradeVerify 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_forward

Progressive step-by-step guide from installation and s-expressions to structs, traits, pattern matching, and modules.

s-exprtypesstructstraitsmodules

Prelude & core built-ins

arrow_forward

Special forms, universal sequence accessors, core types, arithmetic/bitwise operators, and derivable traits.

/prelude

Collections & iteration

arrow_forward

Lazy iterator combinators (/iter), sets (/set), sorted and unordered maps, vectors (/vec), and ring buffers.

/iter/set/map/sorted-map/unordered-map/circular-buffer+2

Text, strings & localization

arrow_forward

String manipulation (/string), regular expressions (/regex), CommonMark (/text/cmark), HTML escaping, and ICU4X (/i18n).

/string/regex/text/text/case/text/cmark/i18n+1

System, filesystem & I/O

arrow_forward

Filesystem operations (/fs), buffered I/O (/io), path manipulation (/path), processes (/process), OS threads (/thread), and async coroutines (/coro).

/fs/io/path/os/os/well-known/process+5

Data, codecs & validation

arrow_forward

JSON encoding/decoding (/codec/json), URI encoding (/codec/uri), CSV tables (/csv), Base64 (/base64), and struct validation.

/codec/json/codec/json-codec/codec/uri/csv/base64/validation+3

Time, date & scheduling

arrow_forward

High-precision clocks, civil dates, time zones, durations (/chrono), Gregorian calendars (/calendar/gregorian), and cron schedules (/cron).

/chrono/calendar/gregorian/cron

Web, HTTP & CLI

arrow_forward

HTTP client/server (/http/*), full-stack web apps (/web/app/*), WebSockets, SHTML/CSS representation, and CLI argument parsing (/cli).

/http/http/client/http/client/json/http/server/web/app/web/app/server+15

PostgreSQL & SQLite databases

arrow_forward

Connection pools, read/write replica routing, strong vs eventual consistency queries (/postgres/client), and embedded SQLite (/sqlite/client).

/postgres/client/sqlite/client

Security, hashing & cryptography

arrow_forward

SHA-256 and HMAC (/crypto), CSPRNG tokens, fast non-cryptographic hashes (/hash), JWT signing/verification (/jwt), and UUIDs (/uuid).

/crypto/hash/jwt/uuid

Mathematics, SIMD & image codecs

arrow_forward

Transcendental math (/math), statistics, 4x4 matrices (/mat), portable SIMD vectors (/simd), PRNGs (/rng), and AVIF/JPEG/PNG/WebP codecs.

/math/num/statistics/mat/simd/rng+5