culebra
Yuji Hirose·yhirose.culebra
Programming language with a bytecode VM, JIT, and AOT compiler
winget install --id yhirose.culebra --exact --source wingetLatest 0.9.0·December 2, 2026
Release Notes
Highlights
- New syntax: @name for self.name and new(@x) field parameters; x is T / x !is T type tests; f(x:) for f(x: x); object rest patterns {a, ...rest}; digit separators (1_000_000); let {*} = NS to take every member of a namespace; the pipe a |> f(b), a low-precedence .; reflected operator methods (radd, rsub, rmul, rdiv, rmod, rpow, rmatmul).
- Language models in the standard library: LLM providers for the Anthropic Messages API and Chat Completions (LLM.openai, LLM.openrouter, LLM.ollama, LLM.openai_compatible), tool-use loops, and Llama / LLM.local to run a model in the process (llama.cpp, with Metal on macOS and Vulkan on Linux and Windows). culebra build links llama.cpp into programs that name Llama.
- Sound: Synth, sound written as an expression (envelopes, filters, voices, stereo, Synth.Mono, Synth.velocity, Proxy); MIDI input and output; Kauai is a namespace of its own with a kauai command line (kauai live plays a recipe from a MIDI controller, kauai convert reads and writes MusicXML); the Playground plays audio on the native mixer in an AudioWorklet, reads Web MIDI, and has Synth Studio and an FM Synth playable from a wind controller.
- Scene: per-vertex colours, packed-byte meshes (node.load(..., positions_as: "i16")), new texture filters (point_mipmap, point_coverage, point_majority), anisotropy and mip bias, detail textures, 3D lines, height fog, distance fade, depth bias, supersampled render targets, and leaner shaders; generic joysticks in Canvas and Scene.
- Performance and memory: --jit compiles a large program in parts side by side and re-optimizes long functions when they are called often; the JIT links an optimized static LLVM (about 1.6x faster translation on macOS arm64); @value runs stay unboxed across more shapes; the GC shrinks its object registry after a burst and gives memory back to the OS after --jit compiles.
- Downloads: a slim download (the VM alone) next to the full one; the full downloads carry Llama; the macOS downloads start on macOS 15. Breaking changes
- The release hook is drop. drop is now an ordinary member name and is not called on release; x.drop() on a value with neither raises a method-miss error instead of returning nil. A trait default drop is a DropContractError. culebra lint warns on a class that still declares drop for this release.
- A field parameter is written new(@x); new(.x) is a parse error.
- Audio.Kauai is now the top-level Kauai, and error messages say Kauai:.
- culebra play is removed; use the kauai command or kauai/tools/play.cul.
- Proc.run / Proc.spawn: the string sent to the child is input: (was stdin:); stdin:, stdout: and stderr: take "pipe" (default), "inherit" or "null".
- Kauai songs: an instrument's knobs go in parentheses after its name (pulse(duty=1/4 env=1,2,4 gap=2), noise(freq=4000->800 len=3)); the external keyword and bare knobs are errors; the instrument is strictly the third word of its line; a program instrument with knobs must declare them ({note|phrase|hit, knobs:, weigh:}); a drum function is called as |n, params|.
- Audio.Graph: modulators: is gone; wire parts with part.connect(target), from any part, with loops passing through a delay.
- size(), empty() and presence() on an iterator or a Range raise a method-miss TypeError.
- A module's export Object is frozen.
- Time.monotonic() and Sys.time() share one origin, process start (each used to start at its first call).
- Random: an isolate's, a Parallel element's and a worker's engine is seeded from the one that started it, so Random.seed in main reproduces them; each spawn advances the parent's sequence once.
- A value one message reaches twice (two closures capturing one Object, [x, x], an Http server's routes) arrives as one value, not as separate copies.
- An Object's String key is every byte it holds, a NUL among them (JSON, CSV and the host API too).
- A scalar receiver's member error names the member (cannot read, cannot set, or the method-miss message) instead of expected Object, Array, or Tensor.
- JSON.parse keeps the last value of a repeated key; Random.weighted_choice rejects negative, non-finite and all-zero weights; Log.set_level, Log.set_format, StateMachine#reset and enable_packrat_parsing return nil. Changes Language / interpreter
- The new syntax listed above, with culebra fmt support (keyword argument spacing, lambdas whose one statement is not an expression keep their braces).
- Effects: an effect fn and an operation bind and check as a plain fn does.
- A trait default method stands in for an operator and for the protocols; an instance whose own fields hold functions answers for itself.
- A bracket write's or a protocol member's contract error points at the member that breaks it and says what the name is for.
- @value: values stay unboxed through constructor calls, spliced method arguments, fields and the shapes a physics step is written in; Name.new names the class declared where it is written.
- StringView is a String for types, natives and ordering.
- An Object that loses a key becomes a dictionary; keys from data make at most 8,192 Shapes per process (GC.stat() reports shapes).
- Keyed tables run a key's eq between their steps, never inside one; an iterator stepped again inside its own step raises.
- for i in range(...) walks on the same counter as for i in a..b.
- The REPL reaches a UFCS name an earlier line declared.
- culebra lint warns on a call that passes more positional arguments than its callee takes. JIT / AOT
- --jit compiles a large program in parts side by side; a function past 4096 blocks starts optnone and is optimized again on its own thread when it is called often.
- A stretch of Float operators runs as bare doubles; cleanup segments of a scope share one release ladder.
- The JIT links culebra-llvm's optimized static LLVM by default where one exists (CULEBRA_SYSTEM_LLVM=1 to opt out).
- culebra build bakes Dir.embedded assets as an object of their own with culebra's LLVM, links only the builtins a program names, and supports Isolate.spawn_source, Llama (--llama-gpu, --llama-cpu) and Kauai alone.
- gzip output is the same bytes on every machine. Standard library
- LLM: turn, chat, ask, request, count_tokens, run_tools with approve, tool_from_schema, repair, and the providers above; Llama.load, generate, chat, device().
- Synth, MIDI, Kauai, Audio.Graph (delay, drive, limit, room, buses, value.cancel(at)), Audio.harmonics, Audio.latency.
- Isolate.spawn_source(source, *args, name:); an Array or Tuple of scalars crosses packed; a dictionary crosses as a dictionary.
- Proc.exec(cmd, env:, inherit_env:) replaces the process with the command; Sys.exit runs exit hooks, then exits; Sys.memory_footprint().
- Dir: d.read_at(path, at, size) reads part of a file.
- Page.socket(): the browser page running a program, as a WebSocket (Playground).
- Args: options before a subcommand, help when run bare, aligned help listing subcommands.
- Scene: node.color, node.load(positions, indices, normals, uvs, colours), node.load_colours, node.bound_radius(), view.texture_mips, view.height_fog, view.pass_triangles(n), view.sprite(..., lut:, vignette:, grain:), mat.depth_bias, mat.distance_fade, tex.anisotropy, tex.mip_bias, render_target(..., supersample:); a View makes its frame targets on its first render_3d; meshes keep no CPU copy of their indices.
- Canvas / Scene input: generic joysticks, "cmd" and keypad key names, "shift" for either Shift key, SDL trigger range, window state read before the window opens.
- Http: a response header sent more than once no longer throws; a WebSocket read timeout no longer closes a message in pieces, and WebSockets use TCP_NODELAY.
- Search: a word and a stacked term highlight one range.
- Math.min / Math.max take one or more arguments.
- GC: CULEBRA_GC_TRACE=1 prints a line per collection. Tooling
- culebra test ends a run with its failures listed; --jobs runs unit test files too.
- culebra docs, the quick guide and the API surface cover the new namespaces.
- Playground: Synth Studio, FM Synth, Kauai songs on recipe instruments, Web MIDI, and the first sound plays without delay.
- Docs: a guide to working with language models, a guide to writing a sound with Synth, an essay on designing for a reader that has not seen the language, and a front-end internals chapter.
- vendor: cpp-httplib v0.67.0, cpp-peglib v1.31.0, cpp-llamalib v1.0.0 (llama.cpp v1.0.0), cpp-searchlib v0.2.1 and others. Full diff: v0.8.0...v0.9.0
Installer type: zip
Details
- Homepage
- https://github.com/yhirose/culebra
- License
- MIT
- Publisher
- Yuji Hirose
- Support
- https://github.com/yhirose/culebra/issues
- Moniker
culebra
Tags
bytecode-vmjit-compilationlanguagellvmprogramming-languages