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.
Pyle is an embeddable dynamic language with a bytecode VM, closures, coroutines, and native bindings.
#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");
}# 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)
}No host framework, no global state, no opinion about your engine. Pyle gives you a language and gets out of the way.
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.
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.
Drive a Coro yourself, or let async.run and async.all schedule work. waitfor suspends until a Future resolves.
Bind free functions, classes, methods, and constructors. Move values across the boundary without a serialization layer.
The pyle interpreter ships json, http, crypto, worker, and declaration files for editors. The core stays lean; the CLI is ready to go.
libpyle compiles for wasm32 with Emscripten. This site runs the real language in the playground, not a reimplementation.
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.
Lexer, parser, compiler, stack VM, garbage collector, and the core natives. Drop it into a C++17 project and register only what you need.
Run scripts standalone. The binary adds the general-purpose modules, their external libraries, the declaration files, and the language server.
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