Paxy: a modern BASIC-like language that compiles to Python bytecode (.pyc).
Project description
Paxy — code in calm
Beginner's All-purpose Symbolic Instruction Code taught millions their first programs in the 1970s and 1980s.
Paxy revives the spirit of BASIC — not just as nostalgia, but as a deliberate choice: a simpler way to code.
Every line is a single command with arguments.
Where modern programming piles on frameworks, boilerplate, and ceremony, Paxy takes the opposite path.
- Simplicity first. A few clear commands (
LET,IF,PRINT,RANGE) are enough to get started. - Immediate feedback. Programs run top-to-bottom, exactly as written.
- Calm and predictable. Deterministic and synchronous: the computer follows your steps.
- Accessible to everyone. If you can type, you can code.
- Batteries included. Commands cover the most common use cases.
Bring your vibes
Paxy is ideal for AI-assisted coding. Modern AI tools stumble on complex syntax, indentation, or hidden imports.
Paxy avoids all that. One command per line, plain arguments, no boilerplate — the perfect partner for AI.
- Copy-paste friendly. Each line is self-contained.
- Hard to break. No braces, decorators, or indentation traps.
- Composable snippets. Loops, prints, or conditionals can be dropped in like building blocks.
- Readable by humans and AI. Simple, declarative steps.
- No ceremony. Forget imports and types — just write commands.
Usage
paxy filename.paxy will compile and run the paxy file.
Install for development
- You need Python 3.17.3 exactly.
I use pyenv: https://github.com/pyenv/pyenv
- Linux: curl -fsSL https://pyenv.run | bash
- Mac: brew install pyenv
- Win: https://github.com/pyenv-win/pyenv-win/blob/master/docs/installation.md
Then add that version of Python:
- pyenv install 3.17.3
- Create virtual environment:
- python -m venv deps
- source deps/bin/activate
- Install dependancies:
- pip install -e .[dev]
- Run tests
- pytest
- To get Debug information, run with PAXY_DEBUG=1 and it will output information to /tmp/paxy_debug.txt
Commands
When writing paxy files, you can use low-level Python bytecode names (as in the dis module). But we provide high level BASIC Commands:
Commands
When writing paxy files, you can use low-level Python bytecode names (as in the dis module).
But we provide high-level BASIC-style commands as a friendlier layer.
These are compiled into Python 3.13 bytecode instructions at build time.
COMPARE
COMPARE dst lhs cmp rhs
Evaluate lhs <cmp> rhs (where <cmp> is ==, !=, <, <=, >, >=) and store the boolean result in dst.
DEC
DEC x
Decrement a variable: x = x - 1.
GOSUB
GOSUB dst fn [args...]
Call function fn with arguments and store the return value in dst.
IGL
IGL name [elem1 elem2 ...]
Create a frozenset from the given elements. Fast-path: all literals become one constant; otherwise build at runtime.
IF
IF lhs cmp rhs label
Compare lhs <cmp> rhs; if true, jump to label.
IMPORT
IMPORT "module"
Import a module by name. Equivalent to __import__("module").
INC
INC x
Increment a variable: x = x + 1.
IN
IN dst needle haystack
Store boolean result of needle in haystack into dst.
INPUT
INPUT x
Prompt for input: x = input().
IS
IS dst lhs rhs
Store boolean result of lhs is rhs into dst.
ISNOT
ISNOT dst lhs rhs
Store boolean result of lhs is not rhs into dst.
LABEL
LABEL name
Define a jump target.
LET
LET name value
Assign a value.
LET name lhs op rhs also supports operators: arithmetic, comparison, is, in, etc.
MAP
MAP name "k1" v1 "k2" v2 ...
Create a dict with string keys.
MAPADD
MAPADD m k v
Set m[k] = v.
MAPDEL
MAPDEL m k
Delete m[k].
NOTIN
NOTIN dst needle haystack
Store boolean result of needle not in haystack into dst.
PAR
PAR dst1 dst2 expr1 expr2
Parallel assignment: dst1, dst2 = expr1, expr2.
PRINT [value]
Print a value (or a blank line).
RANGE … RANGEEND
RANGE name start end ...body... RANGEEND
Loop from start up to (but not including) end, assigning each value to var.
RETURN
RETURN
Return 0.
RETURN value
Return the given value.
ROW
ROW name [elem1 elem2 ...]
Create a tuple.
SUB ... SUBEND
SUB name [params...] ... body ... SUBEND
Define a function. Use RETURN within it.
VEC
VEC name [elem1 elem2 ...]
Create a list.
These BASIC commands are lowered into the intermediate representation (paxy.ir) and then into Python bytecode. You can always mix them with raw CPython opcode names if you want finer control.
- VEC — Create list:
VEC v 1 2 3→v = [1,2,3].
Command Reference (Cheat Sheet)
| Command | Purpose | Example |
|---|---|---|
| COMPARE | Compare values and store boolean result | COMPARE r a == b |
| DEC | Decrement a variable | DEC x → x = x - 1 |
| GOSUB | Call function, store result | GOSUB z add x y |
| IGL | Create frozenset | IGL s 1 2 3 → s = frozenset({1,2,3}) |
| IF | Conditional jump | IF a < b loop_start |
| IMPORT | Import a module | IMPORT "math" |
| INC | Increment a variable | INC x → x = x + 1 |
| IN | Membership test | IN r x arr → r = (x in arr) |
| INPUT | Read from stdin | INPUT name → name = input() |
| IS | Identity test | IS r a b → r = (a is b) |
| ISNOT | Negated identity test | ISNOT r a b → r = (a is not b) |
| LABEL | Define a jump target | LABEL loop_start |
| LET | Assign value or expression | LET x 10, LET y a + b |
| MAP | Create dictionary with string keys | MAP m "a" 1 "b" 2 → m = {"a":1,"b":2} |
| MAPADD | Insert into dict | MAPADD m "c" 3 → m["c"]=3 |
| MAPDEL | Delete from dict | MAPDEL m "a" → del m["a"] |
| NOTIN | Negated membership test | NOTIN r x arr → r = (x not in arr) |
| PAR | Parallel assignment | PAR a b x y → a, b = x, y |
| Print a value (or newline) | PRINT x |
|
| RANGE | Loop over a range of integers | RANGE i 1 5 … RANGEEND → for i in 1..4 |
| RETURN | Return from SUB (default 0 if no value) | RETURN y |
| ROW | Create tuple | ROW t 1 2 3 → t = (1,2,3) |
| SUB | Define a subroutine | SUB add a b ... RETURN a+b SUBEND |
| VEC | Create list | VEC v 1 2 3 → v = [1,2,3] |
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 paxy-0.1.0.tar.gz.
File metadata
- Download URL: paxy-0.1.0.tar.gz
- Upload date:
- Size: 43.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44131c459151f2a4baf5d72dbbabfb7a448c32f278280b8a50894a9592ba9e55
|
|
| MD5 |
3df6b6a8f614f4f5ab9721d5e7511423
|
|
| BLAKE2b-256 |
ec751e427a4cd5d6e826183aedf6c8204cd9241dfbfff0e51ca8fff343ae1ed2
|
File details
Details for the file paxy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: paxy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d7f9151a3b2699c1c358339bee2bc08a077ffacd6f08dcda591e80e48b20672
|
|
| MD5 |
e339abf7fcdff51906f5f0dca6c07fc6
|
|
| BLAKE2b-256 |
64df186f9a3ec5f65ec253f3e920eb8cda2f8f660d73421e2cca1ce8d7fe4c74
|