A fast, optimizing scripting language with a clean Ruby/Python-inspired syntax backed by a high-performance tape VM.
- Fast: Optimized build (
-O3), computed-goto threaded VM dispatch, optional CPU-specific optimization viamake NATIVE=1 - General-Purpose Scripting: Variables, constants, arithmetic expressions, conditionals, and loops
- Low-Level Access: Direct tape manipulation still available (
left,rght,add,goto, etc.) - Smart Diagnostics: Visual caret error messages pointing to the exact source location
- Execution Pipeline:
- Tokenization (zero-copy lexer over
string_view) - Parsing with compile-time symbol table resolution
- Multi-pass peephole optimization
- Jump-target back-patching
- Threaded VM execution (GCC computed-gotos, switch fallback)
- Buffered output (4KB)
- Tokenization (zero-copy lexer over
yascript/
├── src/ # Interpreter implementation
├── include/ # Header files
├── examples/ # Example .ys programs
├── tests/ # Test suite
├── docs/ # Design and optimization documentation
├── Makefile # Build system
└── README.md
- Install:
./install.sh- Uninstall:
./uninstall.shRun inline code:
./yascript -e "let x = 42; print x"Run from a .ys file:
./yascript hello.ys| Syntax | Description |
|---|---|
let x = expr |
Declare a variable, optionally initialized |
let x |
Declare a variable, initialized to 0 |
const N = expr |
Declare a runtime constant |
x = expr |
Assign to an existing variable |
print expr |
Print expression value as a decimal number |
output expr |
Output expression value as an ASCII character |
read x |
Read one byte from stdin into variable |
if expr ... end |
Conditional block |
if expr ... else ... end |
Conditional with else branch |
while expr ... end |
While loop |
| Operator | Description |
|---|---|
* / % |
Multiply, divide, modulo |
+ - |
Add, subtract |
== != < <= > >= |
Comparisons |
| Command | Syntax | Description |
|---|---|---|
| Move left | left [N] |
Move pointer N cells left (default 1) |
| Move right | rght [N] |
Move pointer N cells right (default 1) |
| Increment | add [N] |
Add N to current cell (default 1) |
| Decrement | sub [N] |
Subtract N from current cell (default 1) |
| Set value | set N |
Set current cell to N |
| Direct Seek | goto TARGET |
Seek tape pointer directly to cell TARGET |
| Output | output |
Output current cell as ASCII |
| Input | read |
Read one byte to current cell |
| Print number | print |
Output current cell as decimal number |
| Zero cell | zero |
Set current cell to 0 |
| Loop start | repeat N |
Start loop, repeat N times |
| Loop end | end |
End loop block |
# Print ASCII 'A' then 'B'
let a = 65
let b = 66
output a
output blet i = 1
while i <= 20
let fizz = i % 3
let buzz = i % 5
if fizz == 0
output 70 # 'F'
output 105 # 'i'
output 122 # 'z'
output 122 # 'z'
end
if buzz == 0
output 66 # 'B'
output 117 # 'u'
output 122 # 'z'
output 122 # 'z'
end
if fizz != 0
if buzz != 0
print i
end
end
i = i + 1
endrepeat 72 add; end
output;
- Tape: Unlimited dynamically-expanding tape (zero-initialized)
- Cells: 64-bit unsigned integers (
uint64_t) - Variables: Compile-time tape aliases — zero runtime overhead
- Comments:
#and// - Extension:
.ys - Separators: Newlines or
;(block statements don't require a separator)
makeOptional CPU-optimized build:
make NATIVE=1Run tests:
make testInstall:
sudo make installUninstall:
sudo make uninstallThe image ./docs/assets/logo.png was created using generative AI, or the image is AI generated.


