ash/rakupp: Raku++ — a Raku language interpreter and compiler written from scratch in C++17, validated against t

github.com · 2026-07-22 · by Long Nguyen ·github
Raku++ — a Raku language interpreter and compiler written from scratch in C++17, validated against the Roast spec suite. - ash/rakupp

ash/rakupp

Raku++ — a Raku language interpreter and compiler written from scratch in C++17, validated against the Roast spec suite. - ash/rakupp

13 stars · 1 forks · C++

README

Raku++ A from-scratch implementation of the Raku programming language in C++17, with no third-party dependencies — a hand-written lexer, parser, and tree-walking evaluator that runs real Raku (classes, roles, grammars, regexes, multi-dispatch, junctions, lazy sequences, a bignum tower, Unicode-correct strings, and concurrency), can also compile a program to a standalone native binary, and — as Raku.js — runs in the browser via WebAssembly, no server required. It is not a fork of Rakudo and shares no code with it; it targets the language, measured against Roast, the official Raku test suite. Status: current release v1.0.0 (2026-07-22). Measured per individual test, 90% of Roast passes — 194,506 of ~216,066 tests the suite declares, counting the tests in files that abort before running (their plan N is read from source). On the stricter all-or-nothing bar, 584 / 1,462 files fully pass (~39%) — a file counts only if every assertion in it passes. Early-stage, growing test-first. See the highlights for the key features in bullets, the overview for a one-page tour, the full guide for the complete picture, COUNTING.md for exactly how these are defined, or the CHANGELOG for what each release brought. Install Homebrew (macOS) brew tap ash/rakupp brew install rakupp # or: brew install --HEAD rakupp (latest main) Apple Silicon installs a prebuilt binary (no compile); Intel builds from source. Homebrew itself requires the Xcode Command Line Tools — if brew install says to install them, run xcode-select --install first. Prebuilt binaries (macOS, Linux, Windows) Every release ships self-contained archives on the Releases page: rakupp-macos-universal.tar.gz (Apple Silicon + Intel, macOS 11+), rakupp-linux-x86_64.tar.gz (static libstdc++ — no dependencies), and rakupp-windows-x64.zip (static CRT — no redistributable needed). Unpack keeping the bin/ lib/ include/ layout together (that's what --exe uses) and put bin/ on your PATH. Build from source

Needs a C++17 compiler + CMake → produces build/rakupp

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build

Install onto $PATH (binary + the runtime that --exe links against)

cmake --install build --prefix ~/.local # → ~/.local/{bin,lib,include/rakupp} On Windows (MSVC), build from a Developer Command Prompt and pass the configuration to the build step — the Visual Studio generator is multi-config, so -DCMAKE_BUILD_TYPE alone is not enough: cmake -S . -B build cmake --build build --config Release # → build/Release/rakupp.exe Quick start

Run

rakupp -e 'say "hello, world"' # a one-liner (build/rakupp if not installed) rakupp path/to/program.raku # a file echo 'say 42' | rakupp # from stdin rakupp locates the runtime library --exe needs relative to its own binary, so it works from any directory whether run out of build/ or from an install prefix. If you copy the binary somewhere on its own, point it back with RAKUPP_HOME=<prefix>. build/rakupp -e 'say (1..100).grep(*.is-prime).sum' # → 1060 Common options

Option Meaning

FILE / -e 'CODE' / (stdin) Run a program from a file, a one-liner, or standard input

-I <path> Add a directory to the module search path (repeatable)

--exe SRC -o OUT Native-compile to a standalone binary (also --bundle, --aot)

--highlight [SRC] Syntax-highlight Raku to HTML (--html) or terminal (--ansi)

--lint SRC Static-analyze without running: unused variables, unreachable code, etc. (LINT.md)

--ast SRC Print the parsed AST

--cpp SRC [-O] Print the C++ that --exe transpiles to (add -O to see the optimized codegen)

--help, --version Show help / version

RAKUPP_PARALLEL=1 opts into true CPU parallelism for start/worker threads (default coordinates under a GIL). Full option and environment-variable reference: the guide. Run Raku in the browser — Raku.js ▶ Try it live: raku.online Raku.js is the same interpreter compiled to WebAssembly with Emscripten — the exact semantics as native rakupp, running entirely client-side with no server. It powers an in-page playground (editor + live output, with all the examples/ built in) and can be embedded in any static page to make Raku snippets runnable — handy for docs, tutorials, or a course. Build it with rakujs/build.sh; details in rakujs/README.md. Documentation Start here

presentation/ — a slide deck introducing Raku++ and its ecosystem. Download rakupp-presentation.pdf for a quick flip-through, or open index.html in a browser for the interactive, keyboard-navigable version. The quickest visual tour. HIGHLIGHTS.md — the key features, in bullets, on one page. OVERVIEW.md — a one-page tour: what Raku++ is, its goals, capabilities, and how it compares to Rakudo. GUIDE.md — the full overview: goals, status, the compile modes, running against Roast, architecture.

Language reference

FEATURES.md — inventory of supported language features, by theme. REFERENCE.md — exhaustive lookup sheet: every operator, built-in subroutine, and method, each with a verified example. COOKBOOK.md — a cookbook of runnable one-liner snippets, each verified against rakupp. UNICODE.md — Unicode support: graphemes (UAX #29), normalization, UCA collation, character introspection — the data pipeline and measured coverage. ASYNC.md — concurrency & async: promises, supplies, channels, threads, and the two execution modes. METAPROGRAMMING.md — language-mutation coverage: custom operators, precedence traits, phasers, MOP, macros/slangs.

Code to read and run

examples/ — complete example programs (Mandelbrot, Game of Life, a JSON grammar, a quine, …); see examples/README.md. examples/lint/ demos the --lint analyzer, one rule per file. showcase/ — mid-size showcase programs: a Scheme interpreter built on a Raku grammar, and a pastebin HTTP server on raw sockets; see showcase/README.md. rakujs/ — Raku.js: the interpreter compiled to WebAssembly to run Raku in the browser with no server; includes a playground page with all the examples. Same interpreter as native, compiled with Emscripten; see rakujs/README.md.

Under the hood

ARCHITECTURE.md — how it's built, and what happens to a program in each run mode. PARSING.md — the front end: from source text to AST — the lexer, the Pratt parser, and how user-defined operators (factorial postfix:<!>, custom precedence) are parsed in a single pass. RUNTIME.md — the runtime model: how statically-typed C++ runs dynamic Raku — the Value type, variables and containers, calls and dispatch, and lazy/infinite sequences. MEMORY.md — memory demands and limits: reserved vs. resident, stack sizes and measured recursion depths per mode (interpreter / --exe / wasm), and the data-side guardrails. LINT.md — the --lint static analyzer: the rules it applies, warnings vs. notes, exit codes, and why it stays conservative on Raku's dynamic constructs. OPTIMIZATION.md — the --exe -O optimizer: what it does and how fast it gets. DOGFOODING.md — the Raku tools Raku++ uses to build, test, and measure itself. ECOSYSTEM.md — the projects built on this interpreter (Raku.js, raku.online, spec.raku.online, raku-corpus), how they connect, and the release runbook for rebuilding wasm and redeploying the sites after a new version.

Measurements & status

ROAST.md — Roast suite overview and per-section statistics. COUNTING.md — how the pass-rate numbers are defined and computed (the authoritative methodology). BENCHMARKS.md — a fair speed comparison with Rakudo on the shared subset. NATIVE.md — interpreter vs compiled (--exe) on the example programs; every example compiles natively with identical output. COMPILERS.md — which compiler and architecture to use (arm64 vs x86_64 on macOS, GCC vs Clang, MSVC vs MinGW on Windows), for building Raku++ and for --exe. ROADMAP.md — done / in-progress / next. CHANGELOG.md — release notes for tagged releases.

The story

docs/dev/JOURNEY.md — a memoir of how this was built: the method and the principles. LONGREAD.md — the long-form story: the whole arc from empty directory to ~82% of Roast, a native compiler, and a browser playground.

Author Raku++ is created by Andrew Shitov. Read the announcement: Raku++ — the fastest Raku compiler. License Artistic License 2.0 — the same license Raku itself uses.

source

github.com · 152 links

Comments (0)

No comments yet