All languages

Plush languageexperimental

Maxime Chevalier-Boisvert's minimal dynamically-typed language and register-based VM for teaching and creative coding: actors instead of locks, no FFI, and window, audio and socket host functions built in.

Overview

Plush is Maxime Chevalier-Boisvert's dynamically typed language and register-based bytecode VM, made for fun, teaching and creative coding, with window, audio and socket host functions built in. It exists to explore actor-based parallelism in a language inspired by JavaScript, Lox, Lua, Python and Rust, with no global VM lock and no foreign function interface.

Code

let n = 42;                    // Int64; 0.5 would be a Float64
let s = "plush";               // immutable UTF-8 string
let ok = n > 10 && s != "";    // Bool from comparison and logical operators
$println(n / 4);               // 10.5 — `/` always yields a float
$println(n.idiv(4));           // 10 — truncated integer division
Values and operators, containers and byte buffers, then named functions, closures and classes taking self explicitly with single inheritance; libraries come from a relative file or a standard module. The last slot is the point: a spawned actor gets its own mailbox and collector.

Distinctive traits

  • Actors, not locks: each actor owns a mailbox and a heap, and messages are deep-copied, so shared-memory races cannot occur.
  • No FFI, no package manager: $-prefixed host functions are the only exit, and imports name either a relative file or a built-in standard module.
  • Immutable by default: let binds once and let var opts in, which keeps globals and functions redefinition-free and optimizable.
  • Register-based bytecode VM written in Rust with no global VM lock; the guide claims it can outperform Lua.
  • Creative coding is library, not package: frame buffers are BGRA32 byte arrays and audio is float32 samples.
  • Corner-case budget: assignment is a statement, not an expression, and / always yields a float, so = and == cannot be confused.

Status

Work in progress at version 0.6.x under Apache-2.0, with prebuilt binaries for Linux, macOS and Windows, a REPL, a VS Code extension and bundled examples. The author calls it a fun side-project and warns of bugs and missing features.

Sources & references