esolang

xEec

Nine instructions, one stack of 64-bit unsigned numbers, a carry flag and labels to jump to.

Paulo Jorente, 2015 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 5 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: Hello, World!

The idea

Paulo Jorente designed and implemented xEec in October 2015. It reads like a tiny assembly language. There is no multiplication, no comparison and no way to look below the top of the stack, so programs roll the stack round to reach their numbers and subtract to compare them. The carry flag says when a subtraction went below zero.

The machine

One stack. Words are separated by whitespace and ; starts a comment.

WordDoes
h#9 h$a h?Push 9, push the code of a, push the carry (1 or 0)
pPop
>nameA label
i# i$Read a number or a character
o# o$Write the top as a number or a character, without popping
jzname jnnameJump to the label if the top is 0, or if it is not; no pop
rRoll left: [1,2,3] becomes [2,3,1]
tCopy the top to the bottom
ma msPop the top a and the next b, push a + b or a − b

Numbers wrap at 2 to the 64th, and ma and ms set the carry exactly when they wrap. A jump to a label that does not exist ends the program, which is how most programs stop.

Example

Hello World pushes the text backwards, then prints and pops until the 10 at the bottom is gone and jno…
Expected: 5082
Expected: 106

Hello World pushes the text backwards, then prints and pops until the 10 at the bottom is gone and jno finds an empty stack. The second program multiplies 42 by 121 by adding 121 to itself 41 times. The third divides 319 by 3. It subtracts 3 until the carry shows the subtraction went below zero.

Further

Ideas it shows

Stack-based

Write your own in Run Convert a program from xEec

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run xeec -e 'i# jzend >00 o# jn00 >end o# p' --input '0'
shib manual xeec

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/xeec.js

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

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