Minimalist Scripting Language · An ExtremeRay Project

Code with FractalScript.

A minimalist scripting language for interactive pixel-grid games, text apps and libraries. Grid programs paint an 18-color pixel grid at 60 fps, text apps drive a terminal loop — all from tiny .ez scripts.

Everything below runs right here — the playground is a faithful port of the 1.0.0 engines. Part of the Fractal ecosystem, alongside Fractal SafeView.

Grid example4FractalScript.ez runs live below
Grid(16, 16)

loop-IfRule
  if ([keyboard] {press} = f) {
    set (Grid[r5, c6] {1})
  } else {
    set (Grid[r1, c1, r16, c16] {5})
  }
loop-IfRule-end

A shipped example, straight from the release zip. Press F on the playground screen to paint one cell red, release it to flood the grid green.

A minimalist language for grid games and text apps

FractalScript is a minimalist scripting language for interactive pixel-grid games, text apps and libraries — developed as an ExtremeRay project and implemented in Python with Pygame.

Programs come in two formats. Grid programs open with Grid(width, height) and paint an 18-color pixel grid — every frame, at 60 fps. Text programs open with Text and drive a terminal-style window at 30 fps with variables and output. Both are written as .ez files and built around the same core idea: named loops whose actions run every single frame.

Interaction is built in. Scripts check the keyboard directly with if ([keyboard] {press} = key) and branch with else-if and else. Grid keys repeat while held (after a 0.5-second delay), text keys fire once per press — two input models tuned for their formats.

The language is extensible by design. Python libraries drop into libraries/ and get called via call(Lib[name] {fn, args}), while .el libraries (EzLibrary) define entirely new commands with a syntax template — after import gridly.el, commands like FillCircle(8, 8, 5, 4) become part of the language. The ez command-line tool runs scripts and installs .el libraries straight from a URL.

Version 1.0.0 is published on GitHub Releases as a zip containing the five runtime modules, the bundled libraries and three example scripts — the same programs you can run in the playground below.

Project facts

Lineage
An ExtremeRay Project, 2025–2026
Implementation
Python 3.13+ · Pygame
Formats
Grid (.ez) · Text (.ez) · Libraries (.py / .el)
Runtime
runner.py · translator.py · selector.py · ez_cli.py
License
MIT

Ecosystem

Team
ExtremeTeam
Sibling project
Fractal SafeView

Two formats, one loop model

Everything a FractalScript program does happens inside named loops that run frame after frame. Every feature below is documented in the reference — and executable in the playground.

Grid format

Grid(16, 16) opens a pixel grid of 18 named colors. set (Grid[r5, c6] {1}) paints single cells or whole regions, 1-indexed by row and column.

Text format

The Text header switches to a terminal-style window. say ("Score: ||[Var] {Score}||") writes interpolated output at 30 fps.

Named loops

loop-Name … loop-Name-end wraps every action. All executable code lives inside a loop, and every loop’s actions run on each frame.

Keyboard input

if ([keyboard] {press} = f) { … } reads the keyboard. Held grid keys auto-repeat after 0.5 s; text keys fire once per press.

Variables

Five operations on named slots: set (Var[Score] {create}), add(N), rem(N), set(N) and hold.

Libraries

call(Lib[demo_utils] {greet, "World"}) runs Python; import gridly.el registers new commands from a syntax template.

The complete 1.0.0 surface

Every command in the language, exactly as the shipped engines implement it. All snippets are valid and runnable in the playground.

About the syntax shown here

This page documents the language as implemented by the real 1.0.0 sources — runner.py (grid) and translator.py (text) from the release zip. The playground below is a JavaScript port of those two engines, verified frame-by-frame against them, so what you read here is exactly what runs.

Program structure

A program is a list of lines. // starts a comment (whole-line comments are ignored), and a trailing . is accepted as an optional end-of-line marker. Grid programs open with Grid(W, H), text programs with Text — both outside any loop. Import lines may appear anywhere.

structure.ez
// a grid program
Grid(16, 16)
import gridly.el

loop-Main
  set (Grid[r1, c1, r16, c16] {5}).
loop-Main-end

Rules

All executable code lives inside a named loop. A command outside a loop stops the program with Error: code outside of loop: …, and every loop- needs its matching -end marker. Whitespace is free: indentation is a convention, not syntax.

Grid commands

Grid programs run their loops at 60 frames per second and render every cell as a solid color block. Coordinates are 1-indexed: row 5, column 6 is written r5, c6.

CommandBehavior
Grid(W, H)Create a W×H grid of black (0) cells. Written once, outside the loops.
set (Grid[rN, cN] {C})Set one cell to color C. Rows and columns are 1-indexed.
set (Grid[r1, c1, r2, c2] {C})Fill the rectangle from (r1,c1) to (r2,c2), inclusive, with color C. Only plain color cells are overwritten.
set (Grid[rN, cN] {"path"})Load an image file from disk into one cell (desktop runtime only — the browser playground has no filesystem and skips it).
call(Lib[Name] {Fn, args…})Call a function from a loaded Python library.
import name.elLoad a .el command library — its commands become available to the rest of the parse.

Text commands

Text programs run at 30 frames per second in a terminal-style window. say replaces the display with one line; pass wait(ms) to pause between beats.

CommandBehavior
TextDeclare the text format (header, outside loops).
say ("text ||[Var] {Name}||")Display one line, interpolating variables. The line stays until the next say.
wait(N)Pause the whole program for N milliseconds while the window stays responsive. Text format only.
if ([Var] {Name} = VALUE) { … }Branch while the variable equals VALUE (an integer). Fires every frame the condition holds.
call / importLibraries work in text programs too — the bundled demo_utils greets, adds and rolls dice on cue.

Variables

Variables are named integer slots, created on demand and shared by every loop. One command shape covers all five operations:

OperationFormBehavior
createset (Var[X] {create})Create X with the value 0 (no-op if it already exists).
addset (Var[X] {add(N)})Add N to the current value.
remset (Var[X] {rem(N)})Subtract N from the current value.
setset (Var[X] {set(N)})Replace the value with N.
holdset (Var[X] {hold})Keep the current value — an explicit no-op.

Variables live in both formats: grid programs can count key presses, and text programs read them back inside say with the ||[Var] {Name}|| interpolation.

vars.ez
Text

loop-Counter
  set (Var[Score] {create}).
  if ([keyboard] {press} = z) {
    set (Var[Score] {add(1)}).
    say ("Score: ||[Var] {Score}||")
  } else {
    set (Var[Score] {hold}).
  }
loop-Counter-end

Keyboard

The branch header is if ([keyboard] {press} = key) {, continued by } else-if (…) { and } else { and closed with }. The first matching branch runs, at most one per frame — if a branch fired, the else branch is skipped even when its own condition would hold.

Key names are single characters — the letters a–z and digits 0–9. The engines look keys up as Pygame’s K_a … K_9 constants, and those are the only constants that match this way: longer names parse without error but never fire.

FormatWhile a key is held
Grid (60 fps)The branch fires on the initial press, pauses 0.5 s, then auto-repeats every 0.01 s — hold-to-paint behavior.
Text (30 fps)The branch fires once per press — edge-triggered, made for menus and counters.

Because branches run inside frame loops, the else branch runs on every frame the if doesn’t fire — the classic shipped example floods the grid green exactly while F isn’t being (re)triggered, and paints its red cell whenever it is.

Colors

Cell colors are numbers 0–17, mapped to this fixed palette by runner.py:

Black0
Red1
Orange2
Yellow3
Lime4
Green5
Dark Green6
Light Blue7
Cyan8
Blue9
Dark Blue10
Magenta11
Purple12
Dark Pink13
Pink14
Light Pink15
Dark Gray16
White17

Libraries

Two kinds of library extend the language, and three ship with the release:

.py libraries — plain Python via call()

Drop a Python file into libraries/ and call its functions from any loop. The bundled demo_utils.py provides greet, add, multiply, circle_area and roll_dice:

call.ez
import demo_utils.py

loop-Demo
  call(Lib[demo_utils] {greet, "World"})
loop-Demo-end

.el libraries — new commands from a syntax template

An EzLibrary (.el) declares commands with a Syntax template and Python Func code. After the import, template commands are part of the language — {param} slots capture the arguments:

gridly.el — bundled in the zip
Def {
  Library.name: "Gridly"
  Library.version: v1.0
  Package.identifier: "fractalscript.lib.gridly"
  Library.bypass: true
}

Cmd {
  Syntax: 'FillCircle({centerRow}, {centerCol}, {radius}, {color})'
  Func: '
    set_global("fill_circle", [int(centerRow)-1, int(centerCol)-1,
                               int(radius), int(color)])'
}

Bundled libraries

LibraryKindProvides
gridly.el.el commandsGridResize, SetCell, FillRegion, ClearGrid, DrawOutline, Checkerboard, DrawBorder, FillCircle, DrawLine, FillGradient, GridOverlayOn, GridOverlayOff
gitfetch.el.el commandsFetch(url) InDIR(path), FetchRaw(url) — download files from a URL
demo_utils.py.py functionsgreet, add, multiply, circle_area, roll_dice

The ez command manages it all: ez run "script.ez" auto-detects the format, ez lib "https://…/lib.el" installs a library from a URL, ez libs lists what’s installed. The full authoring guide (LIBRARY_MAKING.md) ships in the zip.

In the playground, the three bundled libraries are built in and import exactly as they do on disk — including their syntax templates. Other .el files report the engines’ usual not-found message.

Errors & messages

The engines talk plainly. These are the exact strings the real runtime prints — the playground reproduces them verbatim:

MessageWhen
Error: code outside of loop: …A command appears outside any loop (grid parse).
Error: loop-NAME already open!A second loop-NAME opens before the first one closed.
Error: loop-NAME-end without matching start!An end marker with no loop behind it.
Error: loop-NAME missing loop-NAME-end!The file ends with the loop still open (grid).
Error: loop 'NAME' missing end markerSame, in text format.
Warning: Unknown command: …A line matches nothing — the program keeps running (grid format).

On top of the language, the playground adds safety caps a desktop app doesn’t need: grids are limited to 64×64, the console keeps 500 lines, programs can’t touch your filesystem (image cells are skipped with a note), and only the bundled libraries can be imported.

Real programs, ready to run

The first three programs are shipped verbatim in the release zip’s Example4FractalScript folder — the same files ez run opens on the desktop. Every card loads straight into the playground.

Grid basics

Grid example4FractalScript.ez shipped

The shipped grid tutorial — one red cell on F, a green flood otherwise, with the author’s own comments.


          

Text & variables

Text example4FractalScript.ez shipped

The shipped text tutorial — count Z presses in a variable and say it back with interpolation.


          

Gridly library demo

Gridly-Library example4FractalScript.ez shipped

The shipped .el demo — gradients, checkerboards, circles, outlines and borders from gridly.el.


          

Color bars

color_bars.ez

Paints six bars from the fixed palette — press P to paint, X to clear. Regions and else-if in a few lines.


          

Step counter

step_counter.ez

A text app — count S presses, and hit a one-time milestone at ten with a variable check.


          

Run FractalScript right now

A faithful port of the 1.0.0 engines, running entirely in this page. Write a .ez program, press Run, click the screen and use your keyboard — grid programs render to a live pixel grid, text programs drive the terminal display.

Screen
the program’s window opens here
grid programs render a live pixel grid · text programs display their latest line
click the screen, then press the keys your program checks
Console
Engine output appears here when you run a program.

Variables

no variables yet

Engine

no program running
Idle Sandboxed: the program text never touches eval or Function. Caps: 64×64 grid · 500 console lines · no filesystem (image cells are skipped) · bundled libraries only. Ctrl+Enter runs.

From source text to pixel grid

The desktop runtime is five Python modules. The playground is a JavaScript port of the two engines behind them — same grammar, same timings, same messages.

Step 1

Parse

translate_file reads the program line by line — comments and trailing dots stripped, Grid(W, H) or Text selects the engine.

Step 2

Register

Commands compile into per-loop action lists; keyboard checks become if-chains; .el syntax templates register as new command matchers.

Step 3

Loop

Every frame, run_loops executes every loop’s actions in order — 60 fps for grid (hold-repeat keys), 30 fps for text (edge-triggered keys, wait()).

Step 4

Render

draw_grid paints each cell from the fixed 18-color palette onto the window — the playground mirrors it on a canvas, cell for cell.

The port is verified, not approximated. Before shipping this page, the browser engine and the real Python engines were run side by side on the same programs with scripted key schedules — the shipped examples, the gridly shape demo, region fills, key-repeat timing, multi-loop programs, text counters with wait(), and the engines’ error paths. After every run, the full grid state, variables and console output had to match cell for cell, line for line.

What differs is only the sandbox. A browser tab has no filesystem and no window manager: image cells are skipped with a note, the grid caps at 64×64, and only the three bundled libraries are available for import. Everything else — parsing, timings, palette, messages — is the engine as released.

Port verification

Test programs
19 scripted runs, both formats
Compared
Grid cells · variables · console lines
Grid timing
Frame-exact (fake 60 fps clock)
Text timing
Outcome-exact (real 30 fps clock)

Downloads

Version 1.0.0 — the full runtime: five Python modules, three bundled libraries, the ez CLI and three example programs. Portable zip — extract it, install Pygame, and run.

Requires Python 3.13+ and Pygame (pip install pygame). Run with ez run "Example4FractalScript/Grid example4FractalScript.ez" — or just try it above, no install needed.

What’s inside the zip
  • runner.py — grid format engine (60 fps)
  • translator.py — text format engine (30 fps)
  • selector.py — smart launcher, auto-detects the format
  • ez_cli.py · ez.bat — the ez command
  • el_compiler.py — .el library compiler
  • library_handler.py — library loader
  • runtime.py — library access to the engine internals
  • libraries/ — gridly.el · gitfetch.el · demo_utils.py
  • Example4FractalScript/ — three example programs
  • README.md · LIBRARY_MAKING.md