Π

From Esolang
Jump to navigation Jump to search

Created by User:Hiant, Fading Entity, Π is principally named after its unique data structure, a swap array. It is composed of three sections, known as "zones". They are the opening zone {, the operating zone ^, and the closing zone }. It is composed of two (cdr,con) cells. A picture is useful here:

[cdr1,[con1,cdr2],con2]

That is, the two cells overlap. The { zone is [cdr1, con1], the ^ zone is [con1,cdr2], and the } zone is [cdr2,con2]. Because the ^ zone is considered "higher" operationally, it is more convenient to draw the data structure like so:

|[con1||cdr2]|
|cdr1]||[con2|

Which looks somewhat like a Π. The operational area consists of an right-infinite tape, where all 'cells' are initialized at 0.

Language Overview

{,^,}          Calling a zone reverses its [con,cdr]
",',%,_        Adds, Subtracts, Modulo's, and Equality Tests (returns 0 for false) the first element of ^ with the last,
zeroing both and storing the result in cdr2.
!              Makes cdr2 equal to con1
/              Places the value in the current cell in cdr1
\              Drops the value in con2 in the current cell
0,1            Literals. These make the value of the current cell 0 or 1, respectively.
[              Brainfuck loop. Skips to the matching ] if the current cell is zero.
]              Brainfuck loop. Returns to the matching [ if the current cell is nonzero.
@              Input. Interprets all characters as ASCII values.