{
  "markdown": "---\ntype: overview\ntitle: drang\ndescription: A small, parallel, Perl-inspired scripting language for text, system glue, and orchestration — implemented in Go, Windows-only.\ntags: [drang, overview, readme, scripting-language]\ntimestamp: 2026-08-12\n---\n\n# drang\n\nA small, parallel, **Perl-inspired** scripting language for text processing, system glue, and\norchestration, implemented in Go (standard library, plus `golang.org/x/sys/windows` for the Win32 APIs). *Reads like Ruby, thinks like Perl, runs\nlike Go.*\n\n*(drang is Dutch/German for drive, urge, momentum.)*\n\n```\n$xs := [1, 2, 3, 4]\nsay(map(filter($xs, |$x| $x % 2 == 0), |$x| $x * $x))   # [4, 16]\n```\n\n## Highlights\n\n- **First-class errors**: failures are ordinary values; `?` propagates them, `//` recovers. No\n  exceptions by default; migration lint warns at directly recognizable discarded, boolean, and\n  output-stringification sites without changing runtime semantics.\n- **Parallelism with isolation**: `pmap` and `spawn` run without a GIL, snapshot mutable callback\n  captures, and share bounded process-wide capacity. Channels, stores, tasks, and process handles\n  are the deliberate shared coordination points.\n- **Bounded under hostile input**: whole-value strings and source reads, materialized collections,\n  recursive parser/snapshot depth, subprocess output, and standalone payloads have explicit ceilings and fail\n  loudly instead of exhausting the process. Streaming paths remain available for larger flows.\n- **Perl's soul, not its warts**: one `$` sigil on every variable, string interpolation and heredocs,\n  `qr//` regex literals, `q//`/`qq//`/`qw//` quotes, and `|>` pipelines.\n- **Glue built in**: `run`/`capture`/`pipe`/`start` with `{cwd, env, env_add, stdin, timeout}` options and\n  process-tree kill on timeout, `stream_lines` streaming, plus channels and tasks.\n- **Batteries, curated**: modules (`use`) — private-by-default, `export` names the API, exports\n  deeply frozen — 161 direct builtins, 15 higher-order forms, and a 25-function drang prelude, JSON & CSV,\n  `qr//` regexes, date/time, hashing/encoding, a persistent key-value store, boundary shape\n  checking (`validate`), and a minimal robust HTTP client (`http_get`/`http_post`). Broad, not a\n  kitchen sink.\n- **Local GUI cockpits**: `serve({routes: ...})` runs a token-gated local htmx server and opens a\n  clamped browser app window; `drang build tool.dr --web web --gui` packs the tool, its assets, and\n  the runtime into one double-clickable exe.\n- **Functions are first-class**: pass any lambda *or builtin* by name: `map($xs, basename)`,\n  `reduce(0, max)`, `filter(bool)`.\n- **Tooling**: `drang fmt` formats faithfully (provenance-preserving) and rewrites atomically,\n  `drang test` runs `example` assertions, and `drang build` produces a bounded, validated standalone\n  executable.\n- **Fast for an interpreter**: a register bytecode VM kept byte-for-byte in lockstep with a\n  tree-walking oracle. The current mixed benchmark is about 1.6× CPython's wall-clock (geometric\n  mean), with faster startup and real multi-core parallelism the GIL can't match.\n- **A REPL**: run `drang` with no arguments (or `drang --repl`); state persists across lines.\n\n## Install\n\ndrang is **Windows-only** (Windows 11 23H2+ / Windows Server 2025+). Grab the prebuilt\n`drang_*_windows_amd64.exe` from the [latest release](https://github.com/anafalanx/drang/releases/latest),\nput it on your `PATH`, or build from source below.\n\n## Build & run\n\n```\ngo build -o drang ./cmd/drang\n\n./drang app.dr              # run a file\n./drang -e 'say(\"hello\")'  # run inline\necho 'say(6 * 7)' | ./drang # run from stdin\n./drang                     # start the REPL\n\n./drang fmt -w app.dr       # format in place (respects read-only files)\n./drang test app.dr         # run the script's `example` assertions\n```\n\nFlags: `--run` (default), `--ast`, `--tokens`, `--version`, `--help`. Arguments after the program are\nexposed to the script as `$ARGV`; the environment is the `$ENV` map.\n\n## Standalone executables\n\nCompile a script into a single self-contained executable (the drang runtime with your program\nembedded) that needs no separate interpreter:\n\n```\ndrang build app.dr -o app.exe\napp.exe one two             # runs the embedded program; args become $ARGV\n\n# Finished GUI: embed web assets and suppress the console window.\ndrang build cockpit.dr --web web --gui -o cockpit.exe\n```\n\n`drang build` validates that the script parses, refuses to overwrite the source or the running\ninterpreter, and writes atomically. Console mode remains the default so errors stay visible during\ndevelopment. `--gui` changes only the standalone's Windows subsystem: Explorer launches it without\na console, so stdout/stderr and startup errors are normally invisible; use it for finished GUI apps.\n\nThe generated standalone is a new executable image. Appending its payload does not preserve an\nAuthenticode signature from the interpreter it was copied from, so sign and timestamp the **final**\n`.exe` after `drang build` when distributing it.\n\n## Documentation\n\n- **[MANUAL.md](MANUAL.md)**: the full language manual. Every self-contained runnable example has\n  its exit status and declared output stream checked against the interpreter; contextual and shell\n  examples are marked and reported separately.\n- **[DESIGN.md](DESIGN.md)**: the design and build log.\n- **[TESTING.md](TESTING.md)**: how drang is verified — the local preflight (`C:\\dev\\z.exe check`),\n  the `-race` suite, and the three fuzzers. There is no hosted CI; the preflight is the release gate.\n\n## Status\n\n**drang 0.12.1**: a compatibility-preserving hardening release. Untrusted whole-value work has\nexplicit ceilings; concurrent callbacks isolate mutable captures; child processes, module/store\nlifecycles, recursive copy, formatter writes, and standalone payloads fail safely; and migration\nlint points out directly recognizable Err misuse. The 0.12 language remains unchanged: modules are\n**private-by-default** (`export` marks the API), and **`validate`** checks map shapes at boundaries.\nThe road here: 0.11.0 brought local htmx GUIs to a clamped browser window; 0.10.0 completed\nsingle-process orchestration\n(`recv_stdout`/`recv_stderr` — drive a child both ways); 0.9 added the persistent store, `walk`,\nand in-place one-liner editing (`-i`); 0.7–0.8 froze the pre-1.0 vocabulary, added kernel-enforced\nresource caps, and made the VM fast. Full history in [CHANGELOG.md](CHANGELOG.md). See the\n*\"Not Yet\"* section of the manual for the remaining gaps: no character ranges, no `match`/`switch`\ndispatch yet, no implicit string↔number coercion (deliberate), and no structs — maps plus\n`validate` stand in, deliberately.\n\n## License\n\n[MIT](LICENSE).\n",
  "bytes": 6726,
  "sha": "0d370209b6705c513a9bf316e1e77c0e37a8e0bfa8cdf6dbec262da9b9a85f5d",
  "repo_slug": "anafalanx/drang",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/okf_anafalanx_drang_index_md_78211d6b/readme"
}