Skip to content
ALB Wiki

Diff — AdaLogic BASIC

Comparing rev 1 → rev 2

-
**AdaLogic BASIC** (**ALB**) is a friendly, modern BASIC dialect for learning and building real programs.
+
**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.
-
> This article is a seed — **you can edit it** and help it grow.
+
## History
+
### Origins
+
+
ALB's story starts with its author, **Rocky L. Oliver**, and an early brush with computing gone wrong. As a very young child — kindergarten or thereabouts — he 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, Oliver had never touched one (his family had no computer at home) and got no instruction beyond "go type this." Fellow students tried to help; the teacher did not. He went home each day with stacks of homework instead. His mother eventually homeschooled him, and he thrived.
+
+
At thirteen he got his 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 he 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 he was writing real software.
+
+
### RockyBASIC and the first compilers
+
+
His first language project was a small compiler/interpreter called **RockyBASIC**, named after himself. Around the same period he built **ASCII Zombies**, a game written in pure C++ — a project currently being redesigned in ALB under the name **Red Sector**.
+
+
He tried other BASIC-family languages — GLBasic, PureBasic — and liked them, but none met his exact requirements. While building an Ada-based game engine he needed a quick way to script enemies and game logic, so he wrote a small DSL called **AdaLog**. That name — Ada plus logic — is where **AdaLogic** comes from.
+
+
RockyBASIC was eventually abandoned. Then, in **2017**, nearly two years later, he came back to it "with a fury" and rewrote the entire compiler in **Ada 2012**.
+
+
### The modern toolchain
+
+
By that point Oliver 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.
+
+
Today the compiler has **many backends** — including **FASM, FASM16, and C** — and the SDK ships with thick and thin bindings across its targets.
+
+
## Design philosophy
+
+
ALB's surface is BASIC-flavored, but its decisions are deliberate:
+
+
* **`--` comments**, borrowed from Ada — chosen simply because the author likes 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.
+
* **`PARALLEL` blocks** — parallel arrays made ergonomic without losing speed.
+
* **Hand-written backends** — the no-IR constraint keeps the whole pipeline understandable and self-owned.
+
+
## Syntax tour
+
+
### 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
+
+
```
+
#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
+
+
```
+
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
+
+
```
+
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
+
+
```
+
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.
+
+
## Implementation
+
+
The compiler is written by hand with **no LLVM-style IR**. Multiple backends exist — **FASM**, **FASM16**, and **C** among them — and ALB can build anything C, FASM, or TypeScript can build, through thick and thin bindings.
+
+
The **browser IDE** ([alb-lang.org/alb-ide](/alb-ide/)) is half ALB, half JavaScript — written to solve the need for a web-based editor, and not a reflection of what a desktop IDE would be. The full proprietary SDK/toolchain is distributed separately at [alb-lang.com](https://alb-lang.com).
+
+
## Editions
+
+
* **Web platform** — free: the IDE, lessons, examples, and this wiki.
+
* **SDK / toolchain** — proprietary, for personal and enterprise use.
+
+
## Who it's for
+
+
Scientists, kids, teachers, hobbyists, game jams, and professionals — anything another language can build, ALB aims to build too.
+
## See also
- [[Main Page]]
- [[Wiki Help]]
-
- [Official handbook](/handbook)
-
- [Browser IDE](/alb-ide/)
+
- [[Red Sector]] — the in-development ALB remake of ASCII Zombies
+
- [Official handbook](/handbook) — the verified syntax sheet
+
- [Browser IDE](/alb-ide/) — write and run ALB in your browser
+
- [Examples gallery](/examples)
[[Category:Language]]
+
[[Category:AdaLogic BASIC]]