Skip to content
ALB Wiki

Diff — AdaLogic BASIC

Comparing rev 32 → rev 33

{{infobox
| title = AdaLogic BASIC
| designed_by = Rocky L. Oliver
| developer = Oliver Softworks
| appeared = 2017 (roots in [[AdaLog]] and RockyBASIC)
| typing = Static — sized integers, floats, vectors/matrices, temporal types
| paradigm = Multi-paradigm — event-driven, structured, transpiler
| files = .alb (program) · .albi (include)
| license = Apache 2.0 (compiler & toolchain)
| family = [[BASIC]] · Prolog/Datalog · Ada · Pascal · C · FASM/asm
| website = [alb-lang.org](/) · [alb-lang.com](https://alb-lang.com)
}}
**AdaLogic BASIC** (**ALB**) is a complete programming language and SDK — a modern BASIC dialect built for learning and for building real software, from games to tools to full applications. It pairs a deliberately beginner-readable surface syntax with a strict static type system, an event-driven program model, and a native toolchain.
```alb:blue by Rocky L. Oliver
This page is my own account — the story of ALB in my own words.
The 1964 bet, kept: programming belongs to everyone.
```
```fact The name is the architecture
**Ada**-**Logic** **BASIC** is three pillars in one name:
- **Ada** — the engineering spine. The whole toolchain is written in **Ada 2012**, the emitters are **SPARK-annotated**, and ALB's strictness — sized types, contracts, range checks, "report and halt" instead of corrupt-onward — is Ada's culture inherited.
- **Logic** — **Prolog and Datalog**. FACT/ASSERT/QUERY/RETRACT/KNOWS/`?-` are real statements: a declarative knowledge base built into the language, not a library bolted on.
- **BASIC** — the covenant. The surface stays readable aloud, because programming belongs to everyone.
```
-
## History
+
# History
-
### Origins
+
## Origins
My story starts with an early brush with computing gone wrong. I was born June 10, 2000, and as a very young child — kindergarten or thereabouts — I had a teacher who split the class into students she believed she could teach and students she simply stopped helping. The day the class first used a computer, I had never touched one (my family had no computer at home) and got no instruction beyond "go type this." Fellow students tried to help; the teacher did not. I went home each day with stacks of homework instead. My mother eventually homeschooled me, and I thrived.
At thirteen I got my first computer — a cheap, unreliable laptop. Keeping it running was an education in itself: fixing things, cleaning off viruses and malware, learning the machine by rescuing it. Around then I got hold of three programming books — *Let Us C*, *Ada as a Second Language*, and *Beginning C++ Game Development* — famously unforgiving texts for a teenager teaching himself. By fifteen I was writing real software.
-
### RockyBASIC and the first compilers
+
## RockyBASIC and the first compilers
My first language project was a small compiler/interpreter called **RockyBASIC**, named after myself. Around the same period I built **ASCII Zombies**, a game written in pure C++ — a project I'm currently redesigning in ALB under the name **Red Sector**.
Then, in **August 2014**, everything stopped: our family home burned down, and there was basically nothing left — including the machine and the work on it. I was fourteen. RockyBASIC's development ended there.
-
### The lost years (2014–2017)
+
## The lost years (2014–2017)
For roughly a year and a half there was nothing to build on. We had lost nearly everything — living with little more than the clothes we had, eventually in a camper. I kept going anyway: experimenting with **Commodore 64 and DOS** — mostly on emulators, sometimes real hardware — and studying history, science, math, and programming/cybersecurity on my own.
Recovery came one machine at a time. A cheap thrift-store laptop came first — not very good, but a start. Then family friends gave me a workstation with a literal name label on it: an **HP Z230** (16 GB RAM, Intel i5-4590), gifted so I could get back to schoolwork. It helped — I was far behind — but about three or four months later I drew up a roughly **$300 budget build**: a $15 case, a GTX 950, the workstation's parts, spare rigging — a real desktop with real power at last. (The Z230 was later reassembled and went back into service once I had more machines.)
The gap years produced small languages and tools of their own:
- **Graefait** — a Borland-style library providing a `graphics.h` header for 64-bit Windows, written to replace the DOS-era graphics lessons my school assignments assumed
- **nandlib** — a NAND-logic language built in NASM, usable from C
- **Keystone** — an experimental language made of clever FASM macros; I wrote a text adventure in it, which is about as far as it went
*Graefait and nandlib are planned to be hosted here for anyone who wants to download or use them.*
-
### The return (2017)
+
## The return (2017)
I had tried other BASIC-family languages before the fire — GLBasic, PureBasic — and liked them, but none met my exact requirements. In the rebuild years my C/C++ game engine — the one behind *ASCII Zombies*, *Riverine Commando*, *Bitland Wars*, *Fractal Lands* — evolved into an **Ada-based engine**, and it needed a quick way to script enemies and game logic. The small DSL I wrote for it was called **[[AdaLog]]**. That name — Ada plus logic — is where **AdaLogic** comes from.
By then I had squeezed everything I could out of SDL and Raylib. A solid engine API, more bindings, more wrappers — and in **2017** I came back to the language itself "with a fury," rewriting the entire compiler in **Ada 2012**.
-
### The modern toolchain
+
## The modern toolchain
By that point I had also mastered **FASM** (the flat assembler) after years of struggling with other assemblers — so the early ALB toolchain was built directly on FASM rather than on any existing infrastructure.
One deliberate constraint shaped everything: **no conventional intermediate representation**. No LLVM, no borrowed backend. The first three or so code-generation backends were written completely by hand. By the time they existed, AI-assisted development was on the rise, and development speed accelerated rapidly on top of that foundation.
```fact No borrowed infrastructure
The ALB compiler has **no LLVM-style IR** — every code-generation backend was written by hand. What a program compiles to is code the project itself owns, end to end.
```
Today the compiler has **many backends** — including **FASM, FASM16, and C** — and the SDK ships with thick and thin bindings across its targets.
-
## Lineage — more than a BASIC
+
# Lineage — more than a BASIC
ALB sits in the [[BASIC]] family tree, but calling it "a BASIC dialect" undersells it. It's a **multi-paradigm language** assembled deliberately from six ancestors — each one contributed something specific, and the seams are visible if you know where to look.
```chart The ancestry
process basic "BASIC"
process prolog "Prolog"
process ada "Ada"
process c "C"
process pascal "Pascal"
process fasm "FASM/asm"
terminal alb "AdaLogic BASIC"
basic -> alb
prolog -> alb
ada -> alb
c -> alb
pascal -> alb
fasm -> alb
```
- **[[BASIC]] — the syntax.** The readable surface: `PRINT`, `LET`, `FOR`/`NEXT`, case-insensitive keywords, the covenant that a beginner's first program should look like English.
- **Prolog — and Datalog — the logic.** The Logic in the name: a real knowledge base (FACT, ASSERT, RETRACT, QUERY, FIND, FINDALL, KNOWS, and the genuine `?-` query form) with rules — declarative reasoning as a first-class language feature, lowered into every backend.
- **Ada — the spine.** The deterministic, safety-oriented engineering style — and, of course, the `--` comments. Ada's influence runs through the type system's strictness.
- **C — the doorway out.** Foreign-function interfacing: ALB reaches into native libraries, ENABLE blocks embed real C, and nothing about the language walls you off from the metal's neighbors.
- **Pascal — the structure.** `BEGIN`/`END` as the program's skeleton, disciplined declarations, structured blocks — the readable-rigor school of design.
- **FASM — and assemblers generally — the floor.** The toolchain was born on FASM, the first backends were hand-written, and ALB keeps a deliberately low-level feel when you drive it that way — near-assembler control, reachable from a friendly syntax.
-
## Design philosophy
+
# Design philosophy
ALB's surface is BASIC-flavored, but its decisions are deliberate:
* **`--` comments**, borrowed from Ada — chosen simply because I like the clean style (classic `REM` is *not* ALB syntax).
* **Case-insensitive keywords** — `PRINT`, `print`, and `Print` are the same word, as in classic BASIC.
* **A real static type system** — sized integers (`U8`–`U64`, `I8`–`I64`, `S32`), floats (`F64`/`REAL`, `PURE`/`RATIONAL`), vector/matrix types (`FLOAT2`, `FLOAT4`, `MAT2`–`MAT4`), `BOOL`, `STRING`, `BINARY`, and hardware-sized `HW8`/`HW16`/`HW32` types.
* **1-based arrays** — index 0 is out of bounds, matching how newcomers count.
* **An event-shaped program model** — `ON TICK` holds update logic and `ON PAINT` holds drawing, so a beginner always knows exactly where code goes. No guessing which loop owns what.
* **Temporal variables** — `HISTORY` and `TEMPORAL` declarations record a variable's values over time, enabling runtime debugging where you can *reverse computation* and step back through a program's history — the same instinct that produced ALB's [[Reversible Computing|REVERSIBLE blocks]].
* **`PARALLEL` blocks** — parallel arrays made ergonomic without losing speed.
* **Hand-written backends** — the no-IR constraint keeps the whole pipeline understandable and self-owned.
```warn Coming from classic BASIC?
`REM` is **not** a comment in ALB — comments start with `--`, Ada-style. And while keywords are case-insensitive, `LET` is for first declarations only.
```
-
## Syntax tour
+
# Syntax tour
The tour below covers the shape of the language — the [official handbook](/handbook) is the verified syntax sheet (the cheat sheet), [Learn](/learn) has guided lessons, the [examples gallery](/examples) has runnable demos, and the [lexicon](/lexicon) explains the terms.
-
### Program skeleton
+
## Program skeleton
```
BEGIN
VERSION 0.0.0.1
CREATE_WINDOW "ALB APP", 960, 640
ON TICK
    -- update logic
END ON
ON PAINT
    -- draw logic
END ON
LISTEN
END
```
Every program starts with `BEGIN`. The optional `VERSION` tag stamps the source's own version. `LISTEN` starts the event loop; `ON TICK` and `ON PAINT` separate simulation from rendering.
-
### Declarations
+
## Declarations
```
#MAX_ENTITIES = 64
LET score = 0
LET hp AS U16 = 100
LET name AS STRING = "ALB"
TYPE SmallHealth IS U16 RANGE 1 .. 255 TEMPORAL
LET px AS I32 HISTORY 16 = 140
```
`LET` declares variables, optionally with explicit types. `TYPE` creates constrained types — `RANGE` bounds and `TEMPORAL`/`HISTORY` make a value replayable. `#NAME = value` defines a constant.
-
### Control flow
+
## Control flow
```
IF hp > 0 THEN
    LET alive = TRUE
ELSE
    LET alive = FALSE
END IF
WHILE hp > 0
    LET hp = hp - 1
END WHILE
FOR i = 1 TO 10 THEN
    PRINT i
END FOR
MATCH mode
    0 => state = 1
    ELSE => state = 99
END MATCH
```
Structured `IF/ELSE`, `WHILE`, `FOR`, and `MATCH` arms with `=>`. `SELECT` uses `CASE`. Keywords are case-insensitive throughout.
-
### Functions, modules, files
+
## Functions, modules, files
```
FUNCTION Twice(x AS U32) AS U32
    RETURN x + x
END FUNCTION
MODULE MathKit
BEGIN
    FUNCTION Add2(x AS U32) AS U32
        RETURN x + 2
    END FUNCTION
END MODULE
IMPORT MathKit
```
`.alb` is a main file; `.albi` is an include file. Modules and namespaces are the real organization mechanism, though — the extensions are a convention, and an include can live in any file name you like.
-
### Arrays and PARALLEL
+
## Arrays and PARALLEL
```
STRICT cells[64] AS U16
LET cells[1] = 10
PARALLEL swarm[128]
    x  AS S32
    y  AS S32
    hp AS U16
END PARALLEL
```
Arrays are 1-based and statically typed; `PARALLEL` declares structure-of-arrays-style records with the ergonomics of a struct and the layout of parallel columns.
-
## Toolchain
+
# Toolchain
ALB compiles through a **master driver**, `alb.exe` (currently 0.2.0), which routes a program to one of many managed backend compilers. I wrote the compiler by hand with **no LLVM-style IR**, and ALB can build anything C, FASM, or TypeScript can build — through thick and thin bindings.
```chart One source, many worlds
terminal src "game.alb"
process drv "alb.exe"
process t "albt"
process w "albw"
process c64 "alb_65"
process rust "albr·albh·albo"
process scr "albp·albl·albm"
process jvm "albj·albn·alba"
process bf "albf"
terminal exe ".exe"
terminal web "browser"
terminal prg ".prg"
terminal nat "native"
terminal sdl "SDL3"
terminal jv "JVM/.NET/Ada"
terminal bfo ".bf"
src -> drv
drv -> t -> exe
drv -> w -> web
drv -> c64 -> prg
drv -> rust -> nat
drv -> scr -> sdl
drv -> jvm -> jv
drv -> bf -> bfo
```
```
alb native game.alb -t fasm --build --outdir build/game
alb web game.alb --build --target es2020
alb c64 demo.alb --build --outdir build/c64
```
-
### Backends
+
## Backends
Every backend has short aliases (`ts`, `rs`, `hs`, `py`, `6502`…); `alb list` shows them all.
The three native `-t` targets inside `albt.exe` each have their own article: the [[ALB FASM backend]] (x86-64 PE64), the [[ALB FASM16 backend]] (16-bit real mode — .COM, MZ .EXE, even boot sectors), and the [[ALB C backend]] (portable C89 + a staged build kit). The web side has its own article too: the [[ALB TypeScript backend]] (albw — browser canvas, console, and audio in one emitted .ts), and the second assembly path is the [[ALB NASM backend]] (albnasm — same emitted dialect through a different assembler and a real linker). The native-tongue path is the [[ALB Ada backend]] (alba — real Ada packages with SPARK mode and its own runtime API), and the managed powerhouse is the [[ALB .NET backend]] (albn — real C# with P/Invoke, a deterministic project, and the whole System.* stack). · [[ALB Lua backend]] · [[ALB MoonScript backend]]
| Command | Executable | What it targets |
| --- | --- | --- |
| `native` | `albt.exe` | Universal compiler: FASM, FASM16, C |
| `web` | `albw.exe` | TypeScript, browser, and Node |
| `c64` | `alb_65.exe` | Commodore 64 / 6502 |
| `brainfuck` | `albf.exe` | Brainfuck (ALBB) native emitter |
| `java` | `albj.exe` | Java / FlatJVM |
| `dotnet` | `albn.exe` | .NET / C# |
| `ada` | `alba.exe` | Native Ada |
| `python` | `albp.exe` | Python |
| `lua` | `albl.exe` | Lua (SDL3 graphics) |
| `moon` | `albm.exe` | MoonScript (SDL3 graphics) |
| `rust` | `albr.exe` | Rust (rustc) |
| `haskell` | `albh.exe` | Haskell / GHC (SDL3) |
| `odin` | `albo.exe` | Odin (SDL3 graphics) |
| `nasm` | `albnasm.exe` | NASM assembly (win64) |
| `godot` | `albgd.exe` | Godot |
| `player` | `alb_player.exe` | ALB program player |
| `agent` | `veronica_main.exe` | Veronica coding agent |
| `prompt` | `alb_prompt.exe` | Prompt and model utility |
-
### Polyglot blocks
+
## Polyglot blocks
ALB programs can embed foreign-language modules inline — ENABLE blocks for C, Ada, ASM, Python, Java, C#, and TypeScript/JavaScript — in the entry file or in INCLUDE files. `alb polyglot inspect|build|run` compiles the modules and the ALB host together into one all-language program.
-
### Packages, tools, doctoring
+
## Packages, tools, doctoring
- `alb pkg` — the package manager (`alb-pkg.exe`); `alb pkg install core` pulls lean, version-locked toolchain packs
- `alb tool <name>` — run a bundled dependency directly (GCC, dotnet, Node) — offline-friendly
- `alb doctor` / `alb deps` — verify compilers and the version-locked dependency bundle
- `alb compile --backend <name>`, `--verbose`, `--dry-run` — routing control and inspection
-
### Graphics RHI
+
## Graphics RHI
`--gfx=<backend>` selects the **alb_gfx** rendering backend DLL at compile time: **OpenGL, Vulkan, or Direct3D 6 through 12**.
-
### Includes
+
## Includes
`INCLUDE "local.albi"` pulls a source-local file; `INCLUDE <alb_gfx.albi>` pulls a system/stdlib include from the SDK's `stdlib/vendor/` directories.
-
### The web IDE
+
## The web IDE
```note
The **browser IDE** ([alb-lang.org/alb-ide](/alb-ide/)) is half ALB, half JavaScript — I wrote it to solve the need for a web-based editor; it isn't a reflection of what a desktop IDE would be.
```
The full toolchain — now Apache 2.0 open source — lives on [GitHub](https://github.com/rockyoliver454/AdaLogic-BASIC-ALB-Programming-Language) and is distributed through [alb-lang.com](https://alb-lang.com).
-
## Licensing
+
# Licensing
```fact Apache 2.0 — October 8, 2026
The entire compiler and toolchain is **open source under the Apache 2.0 license** — every backend, every SDK tool, on [GitHub](https://github.com/rockyoliver454/AdaLogic-BASIC-ALB-Programming-Language). The web platform — IDE, lessons, examples, this wiki — remains free for everyone.
```
-
## Who it's for
+
# Who it's for
Scientists, kids, teachers, hobbyists, game jams, and professionals — anything another language can build, ALB aims to build too. That was the whole point from the start: a language that treats a kindergartner's first `PRINT` and a professional's deadline as equally worth building for.
```alb The living descendant
From [[BASIC|Dartmouth BASIC, 1964]] to ALB — the line numbers are gone, the idea isn't. [[History of Programming]] · [[BASIC]]
```
-
## See also
+
# See also
-
### On this wiki
+
## On this wiki
- [[Main Page]]
- [[Wiki Help]]
- [[BASIC]] — the whole family tree ALB descends from
- [[History of Programming]] — ALB's place in the long arc
- [[AdaLog]] — the original DSL: the Prolog-style logic engine that named AdaLogic, with the Titanium suite
- [[Red Sector]] — the in-development ALB remake of ASCII Zombies
-
### On this site
+
## On this site
- [Handbook](/handbook) — the verified syntax sheet; the cheat sheet
- [Browser IDE](/alb-ide/) — write and run ALB in your browser
- [Learn](/learn) — guided lessons
- [Examples](/examples) — runnable demos
- [Lexicon](/lexicon) — ALB terms and vocabulary
- [ALB SCAN](/scan) — static analysis for ALB programs
- [Toolkit](/alb-toolkit) — utilities built in ALB
- [Help](/help) — getting unstuck
- [Forum](/forum) — the community
[[Category:Language]]
[[Category:AdaLogic BASIC]]