A scripting language that fits inside your C++.

Pyle is an embeddable dynamic language with a bytecode VM, closures, coroutines, and native bindings.

embedding
main.cpp
#include <pyle/pyle.hpp>
#include <pyle/std/std_core.hpp>

struct Vec2 {
    double x, y;
    Vec2(double x, double y) : x(x), y(y) {}
};

int main() {
    pyle::Pyle vm;
    pyle::register_core_natives(vm.vm);

    pyle::ClassBinder<Vec2>(vm.vm, "Vec2")
        .constructor<double, double>()
        .member<double, &Vec2::x>("x")
        .member<double, &Vec2::y>("y")
        .register_globally();

    vm.execute(R"(
        let game = import("game")
        game.start(Vec2(2.0, 3.0))
    )", false, "main.pyl");
}
game.pyl
# Type hints are optional and never enforced at runtime.
struct Entity(id: int, name: string) {}

struct World(entities: array) {
    fn add(e: Entity) => self.entities.append(e)
}

fn start(origin: Vec2) {
    let world: World = World(entities: [])
    world.add(Entity(1, "player"))
    printf("game started at ({}, {})", origin.x, origin.y)
}

fn update(dt: float) {
    printf("update dt={}", dt)
}
$ ./my_game → game started at (2, 3)

Built to disappear into your application.

No host framework, no global state, no opinion about your engine. Pyle gives you a language and gets out of the way.

Embeddable by design

Link libpyle, register the modules you want, and hand it a script. It pulls in only header-only fmt and unordered_dense, and never assumes a host application.

Familiar on purpose

C-like syntax shaped by JavaScript: let, fn, struct, for-in, closures. Runtime behavior borrows from Lua. Nothing to unlearn before you can be productive.

Coroutines that fit

Drive a Coro yourself, or let async.run and async.all schedule work. waitfor suspends until a Future resolves.

Native when it matters

Bind free functions, classes, methods, and constructors. Move values across the boundary without a serialization layer.

Batteries in the CLI

The pyle interpreter ships json, http, crypto, worker, and declaration files for editors. The core stays lean; the CLI is ready to go.

Runs in the browser

libpyle compiles for wasm32 with Emscripten. This site runs the real language in the playground, not a reimplementation.

Take the core. The toolbox is the CLI.

libpyle is the embeddable language, with no CLI modules and no heavy dependencies. The pyle binary adds the general-purpose modules on top. If you want those modules inside an embedder, you add their sources and libraries yourself.

The embeddable core

Lexer, parser, compiler, stack VM, garbage collector, and the core natives. Drop it into a C++17 project and register only what you need.

  • Header-only dependencies
  • Builds for wasm32
  • Core modules: os, path, fs, math, color, proc (native)
  • Bind functions, classes, and methods
add_deps("libpyle")

The batteries-included interpreter

Run scripts standalone. The binary adds the general-purpose modules, their external libraries, the declaration files, and the language server.

  • json, http, crypto, worker
  • raylib module
  • .d.pyl declarations for editors
  • pyle-lsp for VS Code
pyle script.pyl

From C++ to script in a few lines.

Create a VM, register the core natives, and execute a string or a file. Values move across the boundary, errors become values, and the host stays in control.

Read the embedding guide
#include <pyle/pyle.hpp>
#include <pyle/std/std_core.hpp>

int main() {
    pyle::Pyle vm;
    pyle::register_core_natives(vm.vm);

    vm.execute(R"(
        fn greet(name) {
            print("hello, " + name)
        }
        greet("world")
    )", false, "main.pyl");
}

Try the real language in your browser.

The playground is libpyle compiled to WebAssembly. No install, no server round trip. Write a script, hit run, and see what comes back.

Open the playground