Text processing,
built into the language.
guji is a statically-typed, compiled, functional-first language where regex literals and PEG grammars are part of the language — not a library you import.
grammar Email {
rule TOP { <user> '@' <domain> }
token user { \w+ }
token domain { \w+ '.' \w+ }
}
sub main(): Int {
match Email.parse('ada@example.com') {
Some($b) {
print($b.text) # ada@example.com
match $b<user> { Some($u) { print($u.text) } None { } } # ada
match $b<domain> { Some($d) { print($d.text) } None { } } # example.com
}
None { print('invalid') }
}
0
}
Why guji
A small, modern language that takes text seriously and stays honest about types.
First-class regex
Regex literals like /(?<user>\w+)/ and the ~~ match operator return an Option[Match] with named and positional captures.
PEG grammars
Declare grammar / rule / token productions and parse() straight to a typed parse tree (Bush). The signature feature.
Static typing & inference
Local type inference, immutable-by-default bindings, and match that the checker proves exhaustive.
Option, Result, ?
No nulls. Fallible code returns Option/Result, and ? propagates the empty/error case to the caller.
Compiles to native
The compiler lowers programs to C and invokes your system cc to produce a standalone native binary.
Functional-first
Topic lambdas ({ $_ * 2 }) and data-first uniform calls let you chain .filter(...).map(...).sum() cleanly.
Five principles, one language
From §1.1 of the specification — the rules every guji feature answers to.
- One obvious way. For any task there is exactly one idiomatic construct — no redundant syntax.
- Functional-first. Immutable bindings, transformed data, first-class functions, expressions everywhere.
- Inferred static types. Every expression is typed at compile time; annotations are rarely required.
- Text is a first-class concern. Regex and grammars are the language's signature capability.
- One binary. Ahead-of-time compilation to a single self-contained native executable.
Start in a minute
curl -LO https://guji.dev/files/guji-v0.0.1-linux-amd64.tar.gz
tar xzf guji-v0.0.1-linux-amd64.tar.gz # one self-contained binary
./guji hello.guji # run a program
./guji # start the REPL
Get started with guji
Six short, hands-on parts. Each one builds on the last, shows you exactly what to type, and tells you what you should see.
Prerequisites
- Some programming experience. The code here is short, but it helps to know what a function is.
- The guji binary. A single self-contained download — part one walks you through it. (No toolchain needed.)
- A command terminal. Any shell on Linux or macOS; WSL on Windows.
- Optional: a C compiler (
cc/gcc/clang) — only needed for part six, where you compile to a native binary.
Prefer reference material? The full specification lives in the documentation.
Get guji
Download a prebuilt binary — no toolchain required. Current release: v0.0.1.
Download a binary
| Platform | Architecture | Download |
|---|---|---|
| Linux | x86-64 | guji-v0.0.1-linux-amd64.tar.gz |
| Linux | ARM64 | guji-v0.0.1-linux-arm64.tar.gz |
| macOS | Apple Silicon | guji-v0.0.1-darwin-arm64.tar.gz |
| macOS | Intel | guji-v0.0.1-darwin-amd64.tar.gz |
| Windows | x86-64 | guji-v0.0.1-windows-amd64.tar.gz |
| Source | — | guji-v0.0.1-src.tar.gz |
Verify your download against SHA256SUMS. All artifacts are also browsable at /files/.
Install
# Linux x86-64 shown; pick your platform from the table above
curl -LO https://guji.dev/files/guji-v0.0.1-linux-amd64.tar.gz
sha256sum -c --ignore-missing <(curl -s https://guji.dev/files/SHA256SUMS)
tar xzf guji-v0.0.1-linux-amd64.tar.gz
sudo mv guji /usr/local/bin/ # or anywhere on your PATH
guji # REPL starts -- you're done
Build from source (alternative)
If you prefer to build it yourself, you need the Go toolchain (1.22+). Unpack the source tarball, then from its root:
go build -o guji ./src/cmd/guji
Platform notes
- The interpreter and REPL are fully self-contained — download and run, no dependencies.
- macOS: guji v0 binaries are not yet notarized with Apple, so Gatekeeper will warn
“Apple could not verify ‘guji’ is free of malware” if the tarball was downloaded with a
browser. Two fixes:
- Download in the terminal with
curlas shown above — curl doesn't attach the quarantine attribute, so the warning never appears; or - clear the quarantine flag after extracting:
xattr -d com.apple.quarantine ./guji
- Download in the terminal with
- Native compilation (
guji build) additionally needs a C compiler on yourPATH(cc/gcc/clang; on Windows, use WSL or MinGW/Clang).
What works in v0
The interpreter implements the v0 surface end to end and is the reference the native compiler is
tested against. The native compiler passes a 58-fixture acceptance suite, with a few documented gaps
(some deeply-nested collections, string-subject match, mutually-recursive enums).
Modules, user-defined generics, and the extended-regex tier are being restored; concurrency is post-v0.
See the docs for the current status in detail.
guji is dual-licensed MIT OR Apache-2.0.
Release v0.0.1 is built from commit c6d531b of the reference implementation.