Bindings

Raku inside your own program. Run Raku code, call Raku subs with your values, and parse text with Raku grammars — the results come back as your language's own types.

PythonReady. pip install rakulang — macOS, Linux and Windows, the engine inside the package.
Wolfram LanguageAvailable as the RakuppLink paclet in Wolfram's Paclet Repository.
JavaScriptPreview, for Bun. Built from the repository.
GoPreview, with cgo. Built from the repository.
RustPreview, a crate built from the repository.
C++Preview, two headers that ship with the engine.

Python #

pip install rakulang

Python 3.9 or later, on macOS, Linux or Windows. Nothing to compile and nothing else to install: the package carries its own Raku engine.

import rakulang

raku = rakulang.interpreter()

raku.eval('say "Hello from Raku!"')

print(raku.eval("(1..10).sum"))
print(raku.eval("2 ** 100"))
print(raku.eval("<apple banana cherry>.map(*.uc)"))
Hello from Raku!
55
1267650600228229401496703205376
['APPLE', 'BANANA', 'CHERRY']

eval returns ordinary Python values — numbers, strings, lists, dicts — and integers of any size arrive exactly. Everything you declare stays in the interpreter, so a sub defined in one call can be used in the next, or called straight from Python with raku.call("name", …).

Parsing with a grammar #

import rakulang

source = """
grammar Shopping {
    rule  TOP  { <item>+ }
    rule  item { <name> '=' <qty> }
    token name { \\w+ }
    token qty  { \\d+ }
}

class ShoppingActions {
    method item($/) { make $<qty>.Int }
    method TOP($/)  { make $<item>.map(*.made).sum }
}
"""

shopping = rakulang.Grammar.from_source(source, name="Shopping",
                                        actions="ShoppingActions")

m = shopping.parse("milk=2  bread = 1\neggs=12")

for item in m["item"]:
    print(item["name"].str(), item["qty"].int())

print("total:", m.made)
milk 2
bread 1
eggs 12
total: 15

The guide, rakulang — Raku from Python, goes on to your own operators, grammars kept in their own .raku file, errors, and how every type converts.

Wolfram Language #

Raku from Mathematica or the Wolfram Engine 13.3+, published in Wolfram's own Paclet Repository as RakuppLink by Anton Antonov:

PacletInstall["AntonAntonov/RakuppLink"]
Needs["AntonAntonov`RakuppLink`"]

RakuppEval["[*] 1..20"]    (* 2432902008176640000 *)

It needs rakupp installed, whose library it loads. More on the Editors page and in the binding's guide.

Previews: JavaScript, Go, Rust and C++ #

These four work and are tested on every push, but they are not published as packages yet and their surface may still change. They load librakupp, the engine as a shared library, which you build from the repository:

cmake -B build -DCMAKE_BUILD_TYPE=Release -DRAKUPP_BUILD_SHARED=ON
cmake --build build -j
JavaScriptA single-file ES module over bun:ffi. Bun only: plain Node.js cannot run it.
GoA single-file cgo package. Go 1.18+ and a C compiler.
RustA small crate: hand-declared extern "C" bindings and a build.rs that finds the library.
C++Header-only <rakupp/raku.hpp> and <rakupp/grammar.hpp>, linked against the library.

Every guide has the same nine sections in the same order, so you can read one and skim the rest. The overview puts the six APIs side by side.

How it works #