Skip to content

Repository files navigation

Ivory (v1.1.1)

Try Ivory Online

Ivory is a Turing-complete, esoteric programming language (esolang) and Ahead-of-Time (AOT) compiler suite. Originally conceived as a romantic gesture for Valentine's Day 2026, Ivory reimagines the classic tape-memory computational model by introducing a hybrid Tape/Stack architecture, temporal constraints, and hardware entropy through a lexicon of devotion.

Philosophy

Programs in Ivory are designed to read like stream-of-consciousness prose or avant-garde poetry. Unlike traditional languages that prioritize brevity and execution speed, Ivory enforces the "Whisper Constraint", which is a hardcoded 50ms thread delay on standard output to ensure a deliberate, human pace for every character printed to the terminal.

Architecture

Ivory uses a Single-pass Ahead-of-Time (AOT) Transpiler architecture.

  • Frontend: The ivoryc compiler lexes .ivy source files. Unrecognized tokens are intentionally ignored, allowing natural-language comments to be included directly within the logical flow.
  • Intermediate Representation (IR): Ivory code is transpiled into a temporary C++ representation of a 64-bit Hybrid Virtual Machine. To achieve a mathematically Turing-complete, bi-directionally infinite memory tape, the VM utilizes a Sparse Memory Architecture (an O(1) dynamically allocated Hash Map), paired with an infinitely expanding LIFO stack.
  • Backend: The compiler forks a system process, invoking the local GCC toolchain (g++) to perform high-level optimizations (-O3) and link the IR into a standalone, native machine-code binary (ELF for Linux, PE for Windows).

Instruction Set

Ivory extends standard Trivial Brainfuck Substitution (TBS) by implementing 19 distinct opcodes, organized into logical sub-systems:

1. Core Turing Machine Operations

Keyword Action Description
adore + Increment the value at the current memory cell.
miss - Decrement the value at the current memory cell.
hold > Move the data pointer one cell to the right.
release < Move the data pointer one cell to the left.

2. I/O & Control Flow

Keyword Action Description
whisper . Output current cell's ASCII value (enforces 50ms thread delay).
listen , Accept a single character of input into the current cell.
promise [ Begin a loop (Jump forward if the cell value is 0).
always ] End a loop (Jump back if the cell value is non-zero).

3. Memory Stack (LIFO)

Keyword Action Description
cherish push() Push the value of the current tape cell onto the memory stack.
reminisce pop() Pop the top value from the stack and overwrite the current tape cell.

4. Temporal & Environment Control

Keyword Action Description
breathe sleep() Suspend host thread execution for exactly 1000ms.
clear \033[2J Clear the terminal screen using ANSI escape sequences.

5. Developer Quality of Life (QoL)

Keyword Action Description
passion += 10 Add 10 to the current memory cell (Bulk Arithmetic).
heartbreak -= 10 Subtract 10 from the current memory cell (Bulk Arithmetic).
forget = 0 Instantly zero out the current memory cell (State Reset).
confess print(val) Output the raw 64-bit integer value of the current cell for debugging.

6. Architectural Power Features

Keyword Action Description
destiny p = tape[p] Absolute pointer dereferencing (teleports pointer to address).
wonder rng() Hardware entropy injection (assigns a random 64-bit integer using Mersenne Twister).
fade exit(0) Graceful process termination / hardware interrupt.

Hello, World!

Below is a standard "Hello, World!" program.

passion passion passion passion passion passion passion
adore adore whisper passion passion adore adore adore
adore adore adore adore adore adore whisper adore
adore adore adore adore adore adore whisper whisper
adore adore adore whisper forget passion passion passion
passion adore adore adore adore whisper heartbreak miss
miss whisper passion passion passion passion passion adore
adore adore adore adore whisper passion passion adore
adore adore adore whisper adore adore adore whisper
miss miss miss miss miss miss whisper miss
miss miss miss miss miss miss miss whisper
forget passion passion passion adore adore adore whisper
fade

More Example Programs

While Ivory can be used for simple text generation, its 64-bit hybrid architecture allows for highly complex logic and hardware interaction.

The Cat Program (Infinite Echo)

The Cat program is the universal I/O test for esoteric languages. It continuously reads a single character from standard input and echoes it to standard output. In Ivory, the hardcoded 50ms whisper delay turns any user input into a slow, deliberate echo.

listen
promise
    whisper
    listen
always
fade

The Fibonacci Sequence

This program calculates and prints the first 50 numbers of the Fibonacci sequence. It utilizes the confess opcode to natively print the 64-bit integers and the breathe opcode to introduce a deliberate one-second pause between calculations.

clear

passion passion passion passion passion
hold forget
hold forget adore
hold forget
release release release

promise
    hold confess
    breathe

    promise
        miss
        hold hold adore
        release release
    always

    hold
    promise
        miss
        release adore
        hold hold adore
        release
    always

    hold
    promise
        miss
        release adore
        hold
    always

    release release release
    miss
always
fade

Getting Started

Prerequisites

  • A C++ compiler (GCC/MinGW recommended) installed in your system PATH.

Installation

Clone the repository and compile the Ivory compiler suite:

g++ -O3 ivoryc.cpp -o ivoryc

Usage

To compile an Ivory source file into a native executable:

# Explicit output name
./ivoryc script.ivy love_letter.exe

# Defaulting to a.out (Linux) or a.exe (Windows)
./ivoryc script.ivy

Example: The Valentine Payload

The repository includes poem.ivy, a source file initially generated via a Python-based ASCII-offset calculator and heavily augmented with Ivory's temporal opcodes (breathe, clear). When compiled and executed, it outputs a multi-line message dynamically, demonstrating the language's capacity for complex string manipulation, thread blocking, and memory-tape arithmetic.

Author: Kavindu Widyarathne.

Dedicated to: My beautiful girlfriend.

Date: February 14, 2026.

About

A Turing-complete esoteric programming language and hybrid Tape/Stack native AOT compiler.

Topics

Resources

Stars

7 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages