User:TonyBrown148/127

From Esolang
Jump to navigation Jump to search

129 is an esoteric programming language by User:TonyBrown148. It is a language with 1 main stack, 2 symbols, and 9 operations. In 129 the only valid data structure is stacks, and 129 supports Lambda calculus.

Language Specs

Comments

Any character not a brace is a comment in 129.

Stack Representation

A stack is represented using braces. The left brace is at the top of the stack, while the right brace is at the bottom. For example, () represents an empty stack.

Operations

Operation Name Representation Explanation
Insert ((X)) Insert X into the stack. If X is multiple values then their original order is preserved.
Delete ((())()) Pops a value from the main stack.
Duplicate ((())(()())) Duplicates the value on the top of the main stack.
Push ((()(()))()) Pops stack s, pops value v, pushes v into s and pushes s back.
Pop (((()()))(()(()))) Pops stack s, pops value v from stack s, pushes v, and pushes s back.
Release (((()()))(()())) Pops stack s, pushes all the value into the main stack, preserving their original order.
Run ((((()))())(())) Pops stack s, executes the items of s as an 129 program.
Input (()(((())))) Inputs a character and pushes it into the main stack.
Output ((((())))()) Pops a number from the main stack and outputs the character signified by it.

Numerals

In 129, numbers are represented by Church numerals. However, the stack representation is undefined, so pushing, popping or releasing from a number is undefined behaviour. When converting a stack to a number, 129 creates a temporary register A initially 0. Then executes the stack with a temporary command that increases A by 1 as the only command in the main stack. At last 129 executes the command at the top of the main stack, and the converted number is the final value at register A.

Examples

Cat program

((( Pushes a stack that contains.
 (()(((())))) Input
 ((((())))()) Output
 ((())(()())) Duplicate
 ((((()))())(())) Run
)( And push the same stack again.
 (()(((())))) Input
 ((((())))()) Output
 ((())(()())) Duplicate
 ((((()))())(())) Run
)))
((((()))())(())) And run the program.

Or, without comments:

((((()(((()))))((((())))())((())(()()))((((()))())(())))((()(((()))))((((())))())((())(()()))((((()))())(())))))((((()))())(()))