A minimal, formally-verifiable programming language for 2030
Project description
Haxor
Haxor is a minimal, open-source programming language inspired by Python — built for 2030. It fits in under 10,000 lines, runs interactively in a REPL, and ships with a static verifier and a plugin system.
@verify(pre="n >= 0", post="result >= 0")
fn fibonacci(n):
if n <= 1:
return n
return fibonacci(n - 1) + fibonacci(n - 2)
let seq = [fibonacci(i) for i in range(10)]
print(f"Fibonacci: {seq}")
Highlights
| Familiar syntax | Indentation-based blocks, Python-style operators |
| Static verifier | Type inference, sign analysis, missing-return detection |
| Runtime contracts | @verify(pre=..., post=...) checked at call time |
| Plugin system | Add builtins, modules, and pipeline hooks from Python |
| REPL | Multiline input, history, inline verification, /-commands |
| No dependencies | Pure Python — just pip install haxorlang |
Installation
pip install haxorlang
Optional SMT-based verification:
pip install haxorlang z3-solver
To run from source:
git clone https://github.com/ao3575911/haxor
cd haxor
pip install -e .
Quick start
haxor # start the REPL
haxor run examples/hello.hx # run a file
haxor run file.hx --verify # run with static analysis
haxor verify file.hx # static analysis only
Language overview
# Variables with optional type annotations
let x: int = 42
let name = "Haxor"
# Functions, lambdas, and closures
fn add(a, b): return a + b
fn make_adder(n):
return lambda x: x + n
let add5 = make_adder(5)
# Classes and inheritance
class Animal:
fn init(self, name):
self.name = name
class Dog(Animal):
fn speak(self):
return f"Woof! I'm {self.name}"
d = Dog("Rex")
print(d.speak())
# Loops and comprehensions
let evens = [x for x in range(10) if x % 2 == 0]
# Imports
import math
from collections import Counter
# Runtime contracts
@verify(pre="x > 0", post="result > 0")
fn sqrt_safe(x):
return x ** 0.5
Static verifier
Run haxor verify file.hx to catch issues before execution:
- Type inference — flags annotation mismatches and undefined names
- Sign analysis — detects division by zero via abstract interpretation
- Control-flow analysis — warns on functions with missing
returnpaths
$ haxor verify examples/verified.hx
✓ examples/verified.hx: no issues found
Plugin system
# my_plugin.py
from haxor.plugins import Plugin
class MyPlugin(Plugin):
PLUGIN_NAME = "my_plugin"
def register(self, reg):
reg.register_builtin("greet", lambda name: f"Hello, {name}!")
reg.on("post_execute", lambda env: print("done"))
haxor run file.hx --plugin my_plugin.py
Available hooks: post_lex, post_parse, post_execute. See extensions/async_plugin/ for a full example.
REPL commands
| Command | Description |
|---|---|
/verify |
Toggle static analysis on each input |
/env |
Show all current bindings |
/plugins |
List loaded plugins |
/load <path> |
Load a plugin at runtime |
/help |
Show all commands |
/exit |
Quit |
Repository layout
haxor/
├── haxor/ Language core
│ ├── lexer.py Indentation-aware tokenizer
│ ├── parser.py Recursive-descent parser
│ ├── ast_nodes.py AST node definitions
│ ├── interpreter.py Tree-walking interpreter
│ ├── verifier.py Static analysis (type + sign + flow)
│ ├── plugins.py Plugin registry and hooks
│ ├── repl.py Interactive REPL
│ └── stdlib/ Python-backed standard library
├── tests/ pytest suite (179 tests)
├── examples/ Sample programs
├── extensions/ Plugin examples
├── docs/ Language spec, plugin guide, verification docs
└── haxor_cli.py CLI entry point
Contributing
Contributions are welcome — see CONTRIBUTING.md for guidelines. Join the conversation in Discussions.
License
MIT © 2026 Haxor Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hxr-0.1.0.tar.gz.
File metadata
- Download URL: hxr-0.1.0.tar.gz
- Upload date:
- Size: 41.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
671048e3ac72e2bc6fb3d005837593fef250ae51ee14f2caf2599319a4e7a48e
|
|
| MD5 |
1dd46157e7985d22db38f9f82725c090
|
|
| BLAKE2b-256 |
362936788dd8e3463a21e9dca090d8e46a95e4010dcefa35a6ac144f80159630
|
File details
Details for the file hxr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hxr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 37.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbbe8099aebfff977d56657ed7554071463296b0a72dc4c9cba07d6e999fffe9
|
|
| MD5 |
032e104ae406e90abaa570ddb38b2fe1
|
|
| BLAKE2b-256 |
a66816dd5e691f6dd00346f5fae845f2e51bd3dfae44a06d14b94a186c751d80
|