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
Metadata
Release files for hxr 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hxr-0.1.0.tar.gz | 41.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hxr-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 79.2 kB
Release files / hxr-0.1.0.tar.gz
| Download URL | hxr-0.1.0.tar.gz |
|---|---|
| Size | 41.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
671048e3ac72e2bc6fb3d005837593fef250ae51ee14f2caf2599319a4e7a48e
|
|
BLAKE2b-256 checksum How to use checksums |
362936788dd8e3463a21e9dca090d8e46a95e4010dcefa35a6ac144f80159630
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / hxr-0.1.0-py3-none-any.whl
| Download URL | hxr-0.1.0-py3-none-any.whl |
|---|---|
| Size | 37.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbbe8099aebfff977d56657ed7554071463296b0a72dc4c9cba07d6e999fffe9
|
|
BLAKE2b-256 checksum How to use checksums |
a66816dd5e691f6dd00346f5fae845f2e51bd3dfae44a06d14b94a186c751d80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|