esolang

Tri

Every keyword has three characters, from inc to the Laplace limit.

Madk, 2010 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello, world!

The idea

Madk made Tri in 2010 and named it for the length of its keywords. There are 70 of them. Six are brainfuck in disguise, nxt lst inc dec jmp trg, which is enough to make Tri Turing complete. The rest is a scientific calculator, with a stack you can fold with add or mul, trigonometry in degrees, and keywords that set a cell to pi, e, the golden ratio, Apéry's constant or Mills' constant.

Read the story

Anything that is not a keyword is ignored, so keywords can be written together, incincincpsh, or spread out with spaces.

The machine

A tape of real numbers and one stack.

KeywordsDo
nxt lst orgMove along the tape, back to cell 0
inc dec zro one [n]Change the cell
psh pop sto clrPush the cell, pop into it, copy into it, clear the stack
add sub mul div pwr max minFold the whole stack into one value
sin cos neg abs flr sic ...Apply to every value on the stack
out prn lin (text)Print the cell as a number or a character, a newline, a text
jmp trg endLoop while the cell is above 0, stop

The specification does not say which end of the stack is the top. Its Hello World only works if it is the value pushed first, so sub takes the later values from the first one.

Example

The first Hello World builds each character with pushes and products.

The first Hello World builds each character with pushes and products. inc inc psh psh psh mul makes 8, and 8 × 8 + 8 is the 72 of H.

And the second one, which the specification adds right after it.

Expected: Hello, world!

Further

Ideas it shows

Cell-based

Write your own in Run Convert a program from Tri

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: tri.

Command line

shib run tri -e '[84]prn [114]prn [105]prn'
shib manual tri

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/tri.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org