Euclid

From Esolang
Jump to navigation Jump to search
This article is a stub, which means that it is not detailed enough and needs to be expanded. Please help us by adding some more information.

The Euclid programming language is a stack-based / tape-based / befunge-like language created by User:TARDIInsanity. The program remembers which of a fixed set of states (spijmg) it is in, and as it comes across any instruction symbol, it performs some action based on the combination of state and symbol. s - perform operations on the stack p, i, j - perform operations on the program pointer, which always points to cells in the 2d program array. i - (on finding an instruction) pop a value off the stack. if it is zero, ignore the instruction. unconditionally change state to p. j - (on finding an instruction) perform the operation. change state to i. m - perform operations on the memory array, which is a 1-dimensional finite tape initialized to all zeroes. Some memory instructions interact with the stack (mainly ^ which pushes the current cell and v which pops and writes from the stack) g - perform an alGebraic operation on values from the stack. nearly all possible instructions pop two values from the stack, and most push one result value back. The instruction / represents divmod, with the following additional constraint: divmod(x, 0) = (0, x). any of the ten digits 0-9 and the first six letters a-f (hexadecimal) are instructions. the symbols ? = < > ^ v / ` | - x + are also instructions. every instruction has a defined behavior for every mode. the ` character is allowed as a substitute for the backslash character. The creator's implementation of this language can be found here github.com/TARDIInsanity/Euclid. Further documentation about the program's behavior is defined in the doc file. Usage notes for the implementation can be found in the readme file.

A simple truth machine implemented in Euclid:

g86xmv^s+g-ivm|p+
vp/m<
|||||||p>m|||||||

A simple "hello, world!" program:

g3bxaaxc9x4abx+1abx+9abx+..pv
vpx89+xaa1x9cx9c+xba1x4bx48g<
>s|||||||||||||p+

Non-category features to note: -Imperative paradigm -Deterministic -Not quantum, concurrent, reversible, or self-modifying. -Has console IO -Not in the list of known derivatives (partially derivative of befunge) -Text-based code input -Unsure about the theme or lack of a theme