Ogham++

From Esolang
Jump to navigation Jump to search
Ogham++
Paradigm(s) imperative
Designed by Kevin Scannell
Appeared in 2020
Memory system Cell-based
Dimensions one-dimensional
Computational class Turing complete
Major implementations Interpreter and translators
Influenced by brainfuck
Influenced None
File extension(s) .opp

Ogham++ is a Turing-complete language optimized for reliable long-term storage of source code. It was created by Kevin Scannell. Programs are intended to be carved into standing stones using the so-called Ogham script, originally used to carve inscriptions written in early varieties of the Irish language between the 4th and 9th centuries, and now repurposed for the benefit of computer programmers everywhere.

By convention, programs are carved starting at the bottom of a stone and moving upward. As an example, the top of Ogham stone CIIC no. 003 (Cloch na Breaclaí Buí in County Mayo, Ireland) is inscribed with the characters:

ᚊᚒᚅᚐᚊᚐᚅᚑᚄ

which happen to form a valid Ogham++ program.

Language Overview

The language itself is based on a Universal Register Machine (URM) with exactly five registers. It was inspired by Daniel B. Cristofani's construction of a Universal Turing Machine in URM that uses just five registers, together with the fact that the characters in Ogham script are naturally grouped into sets of five, as you'll see below.

The formal specification and some implementations of the language are given here. Language specifications are only considered official if written in the Irish language. All other specifications, including the English description below, are considered unofficial, imprecise, and, frankly, suspect.

The language uses five registers that can store arbitrarily large integers; we denote these T1, T2, T3, T4, and T5. These are initialized to zero when an Ogham++ program begins.

The language supports the following commands:

Command Description
Increment T1
Increment T2
Increment T3
Increment T4
Increment T5
Decrement T1
Decrement T2
Decrement T3
Decrement T4
Decrement T5
᚛x᚜ᚋ Execute command x while T1 is non-zero
᚛x᚜ᚌ Execute command x while T2 is non-zero
᚛x᚜ᚍ Execute command x while T3 is non-zero
᚛x᚜ᚎ Execute command x while T4 is non-zero
᚛x᚜ᚏ Execute command x while T5 is non-zero
Halt the machine

Note that the condition is checked at the beginning of a loop, and so the body of the loop is skipped if there is a zero in the relevant register.

The 18 Unicode characters that are part of the specification above are a proper subset of the characters in the Unicode block for Ogham (U+1680 to U+169F). All other characters in an Ogham++ program are ignored, and so it's possible to insert comments anywhere in the source code. This also includes the possibility of inserting Ogham characters other than those that are part of the language specification, for example, the characters ᚐ, ᚑ, ᚒ, ᚓ, ᚔ that represent vowels in Old Irish. This is why the characters from CIIC no. 003 given above are a valid Ogham++ program.

Example Programs

Put 4 in T2, 5 in T3, add them, and leave the result in T2:

ᚇᚇᚇᚇᚈᚈᚈᚈᚈ᚛ᚇᚃ᚜ᚍᚕ

Put 3 in T2, 6 in T3, multiply them, and leave the result in T2:

ᚇᚇᚇᚈᚈᚈᚈᚈᚈ᚛ᚉᚊᚂ᚜ᚌ᚛᚛ᚇᚄ᚜ᚎᚃ᚛ᚆᚉᚅ᚜ᚏ᚛ᚊᚁ᚜ᚋ᚜ᚍᚕ

Put 7 in T2, compute 7!, and leave the result in T2:

ᚇᚇᚇᚇᚇᚇᚇ᚛ᚆᚂ᚜ᚌ᚛ᚇᚈᚁ᚜ᚋᚃ᚛᚛ᚉᚊᚃ᚜ᚍ᚛᚛ᚈᚄ᚜ᚎᚂ᚛ᚆᚉᚅ᚜ᚏ᚛ᚊᚁ᚜ᚋ᚜ᚌ᚛ᚃᚇ᚜ᚍ᚛ᚄᚅᚈ᚜ᚏᚃ᚜ᚍᚕ

Here is Cristofani's Universal Turing Machine translated into Ogham++:

᚛ᚃ᚛ᚉᚉᚉᚉᚉᚉᚃ᚜ᚍ᚛ᚇᚇᚁ᚜ᚋ᚛ᚆᚆᚆᚂ᚜ᚌ᚛ᚉᚅ᚛ᚉᚅ᚛ᚉᚅ᚛ᚉᚅ᚛ᚉᚅ᚛ᚄᚄᚄᚄᚄᚈᚅ᚛ᚇᚅ᚜ᚏ᚜ᚏ᚜ᚏ᚜ᚏ᚜ᚏ᚜ᚏ᚛ᚊᚂ᚜ᚌ᚜ᚏ᚛ᚊᚃ᚜ᚍᚈᚇᚆᚆᚆ᚛ᚄ᚛ᚂᚆᚄ᚛ᚁᚁᚁᚁᚄ᚛ᚇᚆᚆᚄ᚛ᚈᚈᚈᚂᚁᚁᚄ᚛ᚃᚃᚇᚆᚄ᚛ᚂᚁᚄ᚛ᚈᚇᚆᚆᚆᚆᚄ᚛ᚃᚄ᚛ᚂᚁᚄ᚛ᚁᚄ᚛ᚃᚆᚆᚆᚄ᚛ᚈᚈᚁᚁᚁᚁᚄ᚛ᚈᚆᚆᚄ᚛᚛ᚃ᚜ᚍᚄ᚛ᚈᚈᚈᚁᚄ᚛ᚃᚃᚁᚄ᚛ᚈᚇᚆᚆᚆᚆᚄ᚛ᚈᚈᚂᚁᚁᚁᚁᚁᚄ᚛ᚃᚃᚇᚆᚆᚆᚆᚆᚄ᚛ᚈᚈᚂᚁᚁᚄᚄ᚛ᚁᚄ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚛ᚂ᚛ᚇᚇᚇᚇᚇᚇᚅ᚜ᚏ᚛ᚇᚁ᚛ᚇᚁ᚛ᚇᚁ᚛ᚇᚁ᚛ᚇᚁ᚛ᚂᚂᚂᚂᚂᚉᚁ᚛ᚊᚁ᚜ᚋ᚜ᚋ᚜ᚋ᚜ᚋ᚜ᚋ᚜ᚋ᚛ᚆᚅ᚜ᚏ᚜ᚋ᚛ᚊᚊᚊᚊᚊᚊᚂ᚜ᚌ᚛ᚊᚄ᚛ᚊᚄ᚛ᚊᚄ᚛ᚊᚄ᚛ᚊᚄ᚛ᚅᚅᚅᚅᚅᚆᚄ᚛ᚇᚄ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚜ᚎ᚛ᚉᚂ᚜ᚌ᚜ᚎ᚜ᚌ᚜ᚍᚕ