A programming language optimized for LLM code generation
Project description
Sui (粋) - A Programming Language for LLMs
Zero syntax errors. Zero typos. LLMs generate code that just works.
Try it Now
No installation required - try Sui directly in your browser:
- Sui Playground - Write and run Sui code instantly
- Counter Demo - See Sui + WebAssembly in action
Overview
Sui (粋) is a programming language named after the Japanese aesthetic concept meaning "refined" and "elimination of excess." It is designed so that LLMs can generate 100% accurate code - not through hope, but through structural guarantees.
Why Sui?
Current LLM code generation problems:
- Bracket mismatches
if (x { } - Variable typos
coutnvscount - Indentation errors
- Complex nested expressions
Sui makes these errors structurally impossible:
| Problem | Sui's Solution |
|---|---|
| Bracket mismatch | Only {} for functions, no nesting |
| Variable typos | Sequential numbers only (v0, v1, g0) - can't misspell |
| Indentation errors | Line-based, indentation is ignored |
| Complex nesting | One instruction per line, decompose to temps |
Design Principles
- Zero Syntax Error Rate - Structurally impossible to make syntax errors
- Zero Typo Rate - Variables are numbers, not names
- Line Independence - Each line is completely self-contained
- Pure Logic Language - Computation only; UI delegated to any framework
- Future-Proof Efficiency - As LLMs learn Sui, token efficiency will surpass traditional languages
Installation
# PyPI (basic)
pip install sui-lang
# PyPI with WebAssembly support
pip install sui-lang[wasm]
# Homebrew (macOS/Linux)
brew tap TakatoHonda/sui
brew install sui-lang
# From source
git clone https://github.com/TakatoHonda/sui-lang.git
cd sui-lang
Quick Start
Interactive Mode (REPL)
# Start REPL
sui
# Example session
>>> = v0 10
>>> + v1 v0 5
>>> . v1
>>>
15
>>> .exit
Commands: .exit / .quit (exit), .reset (reset state)
Interpreter
# Run file
sui examples/fibonacci.sui
# Run with arguments
sui examples/fib_args.sui 15
# Validate
sui --validate examples/fibonacci.sui
# Show help
sui --help
Transpiler (Sui → Python)
# Show converted code
sui2py examples/fibonacci.sui
# Output to file
sui2py examples/fibonacci.sui -o fib.py
# Convert and execute
sui2py examples/fib_args.sui --run 15
Transpiler (Python → Sui) for humans
# Show converted code
py2sui your_code.py
# Output to file
py2sui your_code.py -o output.sui
WebAssembly
# Compile to WebAssembly binary (requires: brew install wabt)
sui2wasm examples/fibonacci.sui -o fib.wasm
# Execute directly via WebAssembly (requires: pip install sui-lang[wasm])
suiwasm examples/fibonacci.sui
Browser UI
Sui is a pure logic language. UI can be implemented with any framework (React, Vue, Hono.js, vanilla JS, etc).
Sui compiles to Wasm with exports:
main()- Initializationf0(),f1(), ... - Functions (callable from JS)g0,g1, ... - Global variables (read/write via.value)
// Any framework works
const wasm = await WebAssembly.instantiate(wasmBytes, { env: { print_i32: console.log }});
button.onclick = () => { wasm.exports.f0(); display.textContent = wasm.exports.g0.value; };
Running without Installation (from source)
# Using python directly
python sui.py examples/fibonacci.sui
python sui2py.py examples/fibonacci.sui
python py2sui.py your_code.py
Syntax
Instructions
| Instr | Format | Description |
|---|---|---|
= |
= var value |
Assignment |
+ |
+ result a b |
Addition |
- |
- result a b |
Subtraction |
* |
* result a b |
Multiplication |
/ |
/ result a b |
Division |
% |
% result a b |
Modulo |
< |
< result a b |
Less than (0/1) |
> |
> result a b |
Greater than (0/1) |
~ |
~ result a b |
Equality (0/1) |
! |
! result a |
NOT |
& |
& result a b |
AND |
| |
| result a b |
OR |
? |
? cond label |
Conditional jump |
@ |
@ label |
Unconditional jump |
: |
: label |
Label definition |
# |
# id argc { |
Function definition start |
} |
} |
Function definition end |
$ |
$ result func args... |
Function call |
^ |
^ value |
Return |
[ |
[ var size |
Array create |
] |
] result arr idx |
Array read |
{ |
{ arr idx value |
Array write |
. |
. value |
Output |
, |
, var |
Input |
Variables
| Format | Meaning |
|---|---|
v0, v1, ... |
Local variables |
g0, g1, ... |
Global variables |
a0, a1, ... |
Function arguments |
c0 |
argc (command-line argument count) |
c1, c2, ... |
argv (command-line arguments, read-only) |
Examples
Fibonacci
# 0 1 {
< v0 a0 2
! v1 v0
? v1 1
^ a0
: 1
- v2 a0 1
$ v3 0 v2
- v4 a0 2
$ v5 0 v4
+ v6 v3 v5
^ v6
}
= g0 10
$ g1 0 g0
. g1
Output: 55
FizzBuzz
= v0 1
: 0
> v1 v0 100
? v1 9
% v2 v0 15
~ v3 v2 0
? v3 1
% v4 v0 3
~ v5 v4 0
? v5 2
% v6 v0 5
~ v7 v6 0
? v7 3
. v0
@ 4
: 1
. "FizzBuzz"
@ 4
: 2
. "Fizz"
@ 4
: 3
. "Buzz"
@ 4
: 4
+ v0 v0 1
@ 0
: 9
File Structure
sui/
├── README.md # This file (English)
├── README_ja.md # Japanese README
├── LICENSE # MIT License
├── sui.py # Interpreter
├── sui2py.py # Sui → Python transpiler
├── sui2wasm.py # Sui → WebAssembly binary compiler
├── suiwasm.py # WebAssembly runtime (execute via wasmtime)
├── py2sui.py # Python → Sui transpiler (for humans)
├── examples/
│ ├── fibonacci.sui
│ ├── fib_args.sui
│ ├── fizzbuzz.sui
│ ├── list_sum.sui
│ ├── args_demo.sui
│ └── counter_app/ # Full app example (Sui + Wasm + HTML)
└── prompts/
├── system_prompt_en.md # LLM system prompt (English)
├── system_prompt_ja.md # LLM system prompt (Japanese)
└── examples.md # Application examples (Sui + UI)
LLM Integration
Sui is designed for LLM code generation. Use the prompts in prompts/ directory:
- Copy the system prompt from
prompts/system_prompt_en.md - Paste it into ChatGPT / Claude / Gemini / etc.
- Ask to generate Sui code for your task
- Run with
sui your_code.sui
See prompts/examples.md for prompt templates and expected outputs.
Name Origin
Sui (粋) - A Japanese word meaning "refined," "sophisticated," or "the essence." It represents the aesthetic of eliminating excess and keeping only what is essential.
Token Efficiency: Now vs Future
Current state (LLMs don't know Sui yet):
| Language | Fibonacci | Counter |
|---|---|---|
| Sui | 79 tokens | 44 tokens |
| Python | 30 tokens | 30 tokens |
Future state (after LLMs learn Sui):
v0,g0→ 1 token each (currently 2)- Patterns like
+ g0 g0 1→ compressed - Estimated: 40-50% reduction
But token count isn't the point. The real value:
- 0% syntax error rate (vs ~5-10% for Python/JS)
- 0% typo rate (variables can't be misspelled)
- 100% parseable output (every line is valid or clearly invalid)
vs Other Languages
vs Python/JavaScript
| Aspect | Python/JS | Sui |
|---|---|---|
| Syntax errors | Common | Impossible |
| Variable typos | Common | Impossible |
| Bracket matching | Error-prone | Trivial |
| Token efficiency (now) | Better | Worse |
| Token efficiency (future) | Same | Better |
vs Assembly
| Aspect | Assembly | Sui |
|---|---|---|
| Instructions | Hundreds | ~20 |
| Registers | 8-32 | Unlimited |
| Learning curve | Steep | Minimal |
Roadmap
- Interpreter (Python)
- Transpiler (Sui → Python)
- Transpiler (Python → Sui, for humans)
- Interactive mode (REPL)
- WebAssembly output (WAT + runtime)
- Package manager (hash-based IDs) (#9)
- Standard packages: sui-math, sui-crypto (#8)
- Type annotations (optional)
- LLVM IR output
Future: Standard Packages
Mathematical and utility functions will be provided as standard packages (not built-in):
; sui-math package (48-bit hash ID)
X 182947362847591 0 v2 v0 v1 ; matmul(v0, v1) → v2
X 182947362847591 1 v3 v0 ; transpose(v0) → v3
X 182947362847591 10 v4 v0 ; mean(v0) → v4
X 182947362847591 11 v5 v0 ; std(v0) → v5
; sui-crypto package
X 56284719384756 0 v6 v0 ; sha256(v0) → v6
Design principles maintained:
- No identifiers (package/function IDs are numeric)
- Consistent with package manager design (#9)
- Core language stays minimal
See Issue #8 (sui-math) and Issue #9 (package manager) for details.
License
MIT License
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 sui_lang-0.5.0.tar.gz.
File metadata
- Download URL: sui_lang-0.5.0.tar.gz
- Upload date:
- Size: 30.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1047e28a7fc8df39eb28247646c3cd49d499b8f0d6f61436eeb9956ee83e21f8
|
|
| MD5 |
50e930699f752794b9cedcfc47de4cf7
|
|
| BLAKE2b-256 |
b288c9064ef5dbfaecc6ac1d436c00e8431a01d0607176d1a4a76d6c1606712c
|
File details
Details for the file sui_lang-0.5.0-py3-none-any.whl.
File metadata
- Download URL: sui_lang-0.5.0-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51bce1c0c0a4d4751a352313034ce56c315ab5e56b90e607fb3e0813eed58e5d
|
|
| MD5 |
a7964bcd90d85e7540c4e6692c67f597
|
|
| BLAKE2b-256 |
17b2d30a71c7cb04eb9da9bf9812cc22cd64672bbb47848a60041c75db27b826
|