Ooga Booga

From Esolang
Jump to navigation Jump to search
Ooga Booga
Designed by 0xnullsect0r
Appeared in 2026
Memory system Variables
Dimensions 1D
Computational class Unknown
Reference implementation Unimplemented

Ooga Booga is a LOLCODE-inspired esoteric programming language with a prehistoric, caveman theme, created by 0xnullsect0r in 2026. Programs are written in .ooga source files and compiled by the reference compiler oogac (written in Rust), which transpiles Ooga Booga source to Rust and then invokes rustc to produce a native binary. The language is Turing complete by virtue of mutable state, conditional branching, while loops, and full recursion.

The language's keywords read like cave inscriptions (OOGA, UGHA, UGGA, MAGIC, …), its error messages growl at the programmer, and its type names are named after rocks and pebbles.

Language Overview

Ooga Booga is a strongly typed, imperative language. Its design principles are:

  • One statement per line. No semicolons; no braces.
  • Blocks are closed by UGHA. All block constructs (IFF, UGGA, MAGIC) close with a bare UGHA on its own line.
  • Explicit types everywhere. Every variable, parameter, and return value requires an explicit type annotation using caveman-named primitive types.
  • Caveman keywords. Every reserved word is themed to sound prehistoric.

Execution Model

oogac compiles .ooga.rs in a single pass. The generated Rust file is structured as:

  1. A preamble of runtime helper functions (__ooga_concat, etc.)
  2. All user-defined function definitions (placed before fn main())
  3. A fn main() containing top-level statements in source order

The compiler can be invoked in three modes:

oogac compile program.ooga          # produces program.rs / native binary
oogac compile program.ooga -o out   # custom output path
oogac run program.ooga              # compile and run immediately
oogac check program.ooga            # semantic check, no output

Comments

Comments begin with OOF and extend to the end of the line. They may appear on their own line or at the end of a statement.

OOF This entire line is a comment.
OOGA x: ROCK BE 42   OOF inline comment — x is 42

Data Types

Ooga Booga's type system maps directly to Rust primitive types.

Signed Integers

Ooga Booga Rust type Width Range
TEENYROCK i8 8-bit −128 … 127
SMALLROCK i16 16-bit −32 768 … 32 767
ROCK i32 32-bit −2 147 483 648 … 2 147 483 647
BIGROCK i64 64-bit −9.2×10¹⁸ … 9.2×10¹⁸
HUGEROCK i128 128-bit very large
CLIFFROCK isize pointer-sized platform-dependent

ROCK (i32) is the default integer type.

Unsigned Integers

Ooga Booga Rust type Width Range
TEENYPEBBLE u8 8-bit 0 … 255
SMALLPEBBLE u16 16-bit 0 … 65 535
PEBBLE u32 32-bit 0 … 4 294 967 295
BIGPEBBLE u64 64-bit 0 … 1.8×10¹⁹
HUGEPEBBLE u128 128-bit very large
CLIFFPEBBLE usize pointer-sized platform-dependent

Floating-Point

Ooga Booga Rust type Notes
DRIP f32 single precision
BIGDRIP f64 double precision (default float)

Other Types

Ooga Booga Rust type Notes
GRUNT bool Boolean; literals are YEAH (true) and NAH (false)
SCRATCH char Single Unicode scalar value
WORDS String Owned UTF-8 string
NOTHING () Unit type; return type for void functions

Variables

Variables are declared with OOGA, a type annotation, and BE for the initialiser. Assignment (after declaration) uses GETS.

OOGA count: ROCK BE 0        OOF declare and initialise
count GETS count PLUS 1      OOF reassign

Operators

All operators are written as English cave-words, infix for binary operators.

Arithmetic

Operator Meaning Example
PLUS Addition 3 PLUS 4 → 7
MINUS Subtraction / unary negation 10 MINUS 3 → 7
TIMES Multiplication 6 TIMES 7 → 42
DIVVY Division 10 DIVVY 4 → 2
MOD Modulo 10 MOD 3 → 1

MINUS may also be used as a prefix unary negation: MINUS 5.

Comparison

Comparison operators produce a GRUNT (bool) result.

Operator Meaning Rust equivalent
IS Equal ==
ISNT Not equal !=
BIGGR Greater than >
SMALLR Less than <
BIGGR IS Greater than or equal >=
SMALLR IS Less than or equal <=

BIGGR IS and SMALLR IS are each parsed as a single two-word operator.

Logical

Operator Meaning Rust equivalent
AND Logical AND &&
OR Logical OR
NOT Logical NOT (prefix) !

String Concatenation

PLUS is overloaded for WORDS concatenation. The compiler emits a __ooga_concat() helper call. To concatenate a non-string value, first convert it with WORDY().

SAY "cave" PLUS " " PLUS "creature"       OOF "cave creature"
SAY "count = " PLUS WORDY(count)          OOF "count = 42"

Operator Precedence

Higher rows bind more tightly:

Level Operators
8 (highest) Literals, identifiers, function calls, ()
7 Unary MINUS, NOT
6 TIMES, DIVVY, MOD
5 PLUS, MINUS
4 IS, ISNT, BIGGR, SMALLR, BIGGR IS, SMALLR IS
3 NOT (prefix)
2 AND
1 (lowest) OR

Parentheses may be used to override precedence.

Input / Output

SAY prints an expression to standard output followed by a newline.

SAY "Ooga Booga!"
SAY 42
SAY "Result: " PLUS WORDY(result)

HEAR reads a line from standard input and stores it in a WORDS variable.

HEAR name
SAY "You said: " PLUS name

Conditionals

IFF is the if statement; NOPE is else; NOPE IFF is else-if. The entire construct closes with a single UGHA.

IFF score BIGGR IS 90
    SAY "A"
NOPE IFF score BIGGR IS 80
    SAY "B"
NOPE IFF score BIGGR IS 70
    SAY "C"
NOPE
    SAY "F"
UGHA

Conditions must be GRUNT (bool) expressions. Non-boolean conditions cause a type error.

Loops

UGGA WHILE — While Loop

The body executes repeatedly while the condition is truthy. The condition is checked before each iteration.

OOGA i: ROCK BE 0
UGGA WHILE i SMALLR 5
    SAY i
    i GETS i PLUS 1
UGHA

UGGA DO — Infinite Loop

Runs the body forever until a STOP is reached.

OOGA count: ROCK BE 0
UGGA DO
    count GETS count PLUS 1
    IFF count IS 5
        STOP
    UGHA
UGHA
SAY count    OOF 5

STOP and SKIP

  • STOP — immediately exits the innermost enclosing loop (equivalent to break).
  • SKIP — skips the remainder of the current loop body and proceeds to the next iteration (equivalent to continue).

Both are a semantic error if used outside any loop.

Functions

Functions are defined with MAGIC and closed with UGHA. All parameter types and the return type are required. Use -> NOTHING for functions that do not return a value.

MAGIC add(a: ROCK, b: ROCK) -> ROCK
    GIVEBACK a PLUS b
UGHA

OOGA result: ROCK BE add(3, 4)
SAY result    OOF 7

GIVEBACK returns a value. GIVEBACK with no expression returns from a -> NOTHING function. Functions may call themselves recursively, and mutual recursion is supported.

MAGIC factorial(n: BIGROCK) -> BIGROCK
    IFF n SMALLR IS 1
        GIVEBACK 1
    UGHA
    GIVEBACK n TIMES factorial(n MINUS 1)
UGHA

Built-in Functions

The compiler automatically injects these helper functions into the output; no import is needed.

Function Input Output Description
WORDY(x) any WORDS Convert any value to string
NUMBR(x) WORDS ROCK Parse string as i32
NUMBR_BIG(x) WORDS BIGROCK Parse string as i64
NUMBR_DRIP(x) WORDS BIGDRIP Parse string as f64
BIGNESS(x) WORDS BIGROCK String byte length
FLOORY(x) BIGDRIP BIGDRIP Floor
ROUNDY(x) BIGDRIP BIGDRIP Round to nearest integer
ROOTY(x) BIGDRIP BIGDRIP Square root

Reserved Words

Keyword Purpose
OOF Line comment
OOGA Variable declaration
BE Initialiser (used with OOGA)
GETS Assignment
SAY Print to stdout
HEAR Read line from stdin
IFF If statement
NOPE Else / else-if
UGHA End block
UGGA Loop prefix
WHILE While-loop (after UGGA)
DO Infinite loop (after UGGA)
STOP Break out of loop
SKIP Continue to next iteration
MAGIC Function definition
GIVEBACK Return from function
PLUS Addition / string concatenation
MINUS Subtraction / unary negation
TIMES Multiplication
DIVVY Division
MOD Modulo
IS Equality
ISNT Inequality
BIGGR Greater than
SMALLR Less than
AND Logical AND
OR Logical OR
NOT Logical NOT
YEAH Boolean true
NAH Boolean false
NOTHING Unit / void return type

Examples

Hello, World!

OOF Hello World in Ooga Booga!
OOF Cave creature greet the world.

OOGA greeting: WORDS BE "Ooga Booga! Cave greet world!"
SAY greeting
SAY "Much wow. Very caveman. So language."

Output:

Ooga Booga! Cave greet world!
Much wow. Very caveman. So language.

Factorial (recursive)

OOF Factorial — cave brain compute big numbers!
OOF Uses recursion to show Turing completeness.

MAGIC factorial(n: BIGROCK) -> BIGROCK
    IFF n SMALLR IS 1
        GIVEBACK 1
    UGHA
    GIVEBACK n TIMES factorial(n MINUS 1)
UGHA

SAY "5! ="
OOGA result: BIGROCK BE factorial(5)
SAY result

Output:

5! =
120

Fibonacci (recursive)

OOF Fibonacci sequence — cave count spiral numbers!

MAGIC fib(n: ROCK) -> ROCK
    IFF n SMALLR 2
        GIVEBACK n
    UGHA
    GIVEBACK fib(n MINUS 1) PLUS fib(n MINUS 2)
UGHA

OOF Print fib(0) through fib(10)
OOGA i: ROCK BE 0
UGGA WHILE i SMALLR IS 10
    SAY fib(i)
    i GETS i PLUS 1
UGHA

Loop Demo (sum 1–100; do/stop)

OOF Loop demo — sum numbers 1 to 100.

OOGA i: ROCK BE 1
OOGA s: ROCK BE 0
UGGA WHILE i SMALLR IS 100
    s GETS s PLUS i
    i GETS i PLUS 1
UGHA
SAY s

OOF Infinite loop with break
OOGA n: ROCK BE 0
UGGA DO
    n GETS n PLUS 1
    IFF n IS 3
        STOP
    UGHA
UGHA
SAY "CAVE COUNT TO 3 THEN STOP"

FizzBuzz

OOF FizzBuzz — cave edition

OOGA i: ROCK BE 1
UGGA WHILE i SMALLR IS 30
    IFF i MOD 15 IS 0
        SAY "FizzBuzz"
    NOPE IFF i MOD 3 IS 0
        SAY "Fizz"
    NOPE IFF i MOD 5 IS 0
        SAY "Buzz"
    NOPE
        SAY i
    UGHA
    i GETS i PLUS 1
UGHA

Implementation

The reference implementation is oogac, written in Rust. The compiler pipeline is:

  1. Lexer (lexer.rs) — tokenises the source file
  2. Parser (parser.rs) — recursive descent parser producing an AST
  3. AST (ast.rs) — node definitions for all language constructs
  4. Semantic analyser (semantic.rs) — type checks and validates scopes
  5. Code generator (codegen.rs) — emits Rust source from the AST
  6. CLI (main.rs) — compile / run / check subcommands via clap

The test suite contains 41 tests covering all stages. CI runs on GitHub Actions.

See Also

  • LOLCODE — the primary inspiration

External Resources