Skip to content
plixlangPublic

About

A fast, safe, gradually typed programming language with an interpreter and a native Cranelift compiler.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

9 stars

Watchers

0 watching

Forks

Repository files navigation

Plix

A small, gradually typed programming language with an interpreter and a native compiler.

Current development release: v0.10.1. Plix source files use the .px extension. The toolchain is implemented in Rust and provides two execution paths with the same language semantics:

  • plix run interprets a program for fast iteration and readable diagnostics.
  • plix build produces a native executable through Cranelift.
  • plix exec compiles and immediately runs a program.

Status. v0.10.1 is a stabilization release on the road to v1.0.0. The Stability and API freeze (roadmap §1.1) is active since v0.9.18: the public surface — stdlib globals, constants, modules and CLI commands — is pinned in the machine-checked api_freeze.json inventory with snapshot metadata (version, date, inventory SHA-256); every API change is recorded in API_CHANGELOG.md. plix api reports the freeze, plix api --check verifies it in CI, plix api --export regenerates the manifest. Breaking removals now require a language-change record; the full LTS contract of roadmap §1.1 applies when v1.0.0 is released.

The native ABI (exported plix_* runtime symbols, calling convention, V representation) is frozen separately in abi_freeze.json with plix abi commands and its own changelog. The test battery (tests/run_all.sh) includes a differential run (interpreter output == native output for every suite), 200 parser fuzz programs, negative error programs with exact locations, and a per-target smoke test (tests/targets.sh, matrix in docs/targets.md).

Quick start

Run from a release archive

Download the archive for your platform from the GitHub Releases page, extract it, put bin/plix (or bin/plix.exe) on your PATH, then verify it:

plix --version
plix run examples/typed.px
plix build examples/closures_match.px -o closures
./closures

See the complete platform and linker requirements in docs/install.md.

Run with Docker

The latest release is published on Docker Hub as plixlang/plix. The image is useful for trying Plix without installing a binary, for CI, and for sandboxed builds. It contains the full plix toolchain and runs as a non-root user by default.

# Verify the installed version
docker run --rm plixlang/plix:latest --version

# Run a Plix program from the current directory
docker run --rm -v "$PWD:/work" -w /work plixlang/plix:latest plix run app.px

# Build a native Linux executable from the current directory
docker run --rm -v "$PWD:/work" -w /work plixlang/plix:latest plix build app.px -o app

Windows PowerShell uses the same image; replace "$PWD" with ${PWD}:

docker run --rm -v "${PWD}:/work" -w /work plixlang/plix:latest plix run app.px

Pin a release instead of latest for reproducible workflows, for example plixlang/plix:v0.10.2. See Docker installation for more examples, including WASM builds and LSP use.

Build from source

Plix requires a current stable Rust toolchain and a host C linker for native executables. Python is not required unless using the optional Python FFI.

git clone https://github.com/plixlang/plix.git
cd plix
cargo build --release --locked
./target/release/plix --version
bash tests/run_all.sh ./target/release/plix

A first program

func fib(n: int) -> int {
    if (n <= 1) { return n; }
    return fib(n - 1) + fib(n - 2);
}

struct Vec2 { x: float, y: float }
impl Vec2 {
    func norm2(&self) -> float { return self.x * self.x + self.y * self.y; }
}

say("fib(20) = ${fib(20)}");
say("norm² = ${Vec2 { x: 3.0, y: 4.0 }.norm2()}");

Save it as app.px, then run either:

plix run app.px              # interpreter
plix build app.px -o app     # native executable
./app

Language and runtime highlights

  • Gradual typing: type annotations are optional; the checker reports provable mismatches and native compilation specializes provably typed values.
  • Data-oriented OOP: struct, impl, and trait, with &self and &mut self receivers; there is no data inheritance.
  • Ownership where required: own, &, and &mut enable static ownership and borrowing checks. auto and const values use the runtime memory model.
  • Everyday language features: functions and closures, arrays and objects, pattern matching, loops, modules, string interpolation, slicing, and errors.
  • Native and interpreted execution: the repository checks observable output parity between both paths for its examples, guards, and fuzz inputs.
  • Optional Python FFI: import py "numpy" as np; accesses CPython through the C API. Read the FFI safety and installation notes before using it.

Command line reference

Command Purpose
plix run [file.px] [args...] Interpret a program.
plix build [file.px] -o <file> Compile a native executable.
plix exec [file.px] [args...] Compile and execute natively.
plix check <file.px> Parse, type-check, and ownership-check.
plix test [paths...] Run *_test.px test suites.
plix fmt [--check] [paths...] Format Plix source.
plix lint [paths...] Report built-in lint diagnostics.
plix repl Start the interactive shell.

When a project contains plix.toml, the run/build/test commands can discover its configured entry point and test paths. See docs/tooling.md.

Documentation

Start here:

Quality and development

The release verification battery runs examples through interpreter and native modes, runs negative checker suites, and compares their normalized output. A deterministic parity fuzzer generates additional programs for both modes.

cargo fmt --all -- --check
cargo check --workspace --locked
cargo test --workspace --locked
cargo build --release --locked
bash tests/run_all.sh ./target/release/plix
bash tests/fuzz_parity.sh 150 ./target/release/plix

See CONTRIBUTING.md for the contributor workflow and docs/testing.md for what each command proves.

Project layout

src/        CLI, lexer, parser, checker, interpreter, native code generator
rt/         embedded runtime: tagged values, heap, standard-library services,
            networking, and optional Python FFI
examples/   runnable language examples
tests/      Plix test suites, parity guards, and deterministic fuzzing
docs/       user, language, tooling, security, testing, and release documents
bench/      benchmark programs and harness

Community and security

About

A fast, safe, gradually typed programming language with an interpreter and a native Cranelift compiler.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

9 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages