Z

From Esolang
Jump to navigation Jump to search

Z is a programming language developed by User:Challenger5 in April - May 2016, which uses only lowercase and capital Z, space, and newline. It is essentially assembly code with several modifications. It is based on "words" of up to 3 of the letter Z. Each word has sub-words separated by spaces, which combine to create a statement. Statements are separated by newlines. However, statements can also be separated by double spaces, and are treated as one line by the "zzz" and "zzZ" commands. Note that the case of the Z matters. It uses a preparing number system to make it easy to interpret because the author was lazy. The system works using several commands that "prepare" a number, and other commands use the prepared number as input. It was partially inspired by brainfuck for the idea of a number table with cells. However, the language is much easier than it.

Syntax

z - accepts input, stores in variable A
Z - outputs variable A
zz - puts values in A
    z - puts fixed value based on digits. Multiple words are multiple digits.
        z - one
        Z - two
        zz - three
        zZ - four
        Zz - five
        ZZ - six
        zzz - seven
        zzZ - eight
        zZz - nine
        zZZ - zero
    Z - gets value at index of A on number grid. Stores in A.
zZ - move pointer to index A.
Zz - replace number at pointer with A.
ZZ - change number at index of pointer
    z - increase number by A
    Z - decrease number by A
zzz - jump to line A
zzZ - jump to line A if value at pointer is 0

The following code is a Hello World program (printing out ASCII values):

zz z zzz Z  Z
zz z z zZZ z  Z
zz z z zZZ zzZ  Z  Z
zz z z z z  Z
zz z zz Z  Z
zz z zzZ zzz  Z
zz z z z z  Z
zz z z z zZ  Z
zz z z zZZ zzZ  Z
zz z z zZZ zZZ  Z
zz z zz zz  Z

A cat program:

z  Z

A truth-machine:

z  Zz
zz z zZ  zzZ
zz z z  Z  zz z zz  zzz
zz z zZZ  Z

A Fibonacci program:

zz z zZZ  Z
zz z z  zZ  Zz
zz z Z  zz Z
ZZ z  Z
zz z Z  zZ
zz z z  zz Z
ZZ z  Z
zz z z  zZ
zz z zz  zzz

External Links