We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Pyþon

From Esolang
Jump to navigation Jump to search
Pyþon
Designed by User:Jan Pilavik
Appeared in 2026
Dimensions 1
Computational class Turing-complete
Reference implementation Unimplemented

Pyþon is an esoteric programming language that uses only four characters: þ, =, [, and ]. The name is derived from Python.

Syntax & Characters

The language strictly consists of only four characters: þ, =, [, and ].

Element Reference

  • þ[n][m] refers to the m-th element from the top (0-indexed) of stack n.
    • Stack index (n): Any integer (positive, negative, or zero).
    • Element index (m): Non-negative integers (0, 1, 2, ...), where 0 is the top of the stack.
  • þ[][] is shorthand for þ[0][0], which evaluates to the constant value 1.

Comments

Any line that does not conform to the valid statement format (<n>=<m>), or any line containing characters other than þ, =, [, and ], is treated as a comment and ignored during execution.

Program Structure & Execution

Each line in the program represents one command/instruction (line numbers serve as instruction indices).

There are two main statements:

  1. Pushing a value: <value>=<integer>
  2. Executing an instruction: <stack_number>=<instruction>

Numbers & Expression Evaluation

Literals and digits do not exist natively in the language source code. Numbers are represented by zero or natural numbers, or constructed through arithmetic expressions using þ[][] (= 1) and stack operations.

Initial State

The memory consists of an infinite array of stacks indexed by all integers . At the start of execution, stacks are initialized as follows (where the leftmost element is the top of the stack):

Stack Index (n) Initial Contents (Top → Bottom)
Stack 0 [1, -1, 1, -1, ...] (infinite alternating sequence)
Stack 1 [add, sub, mul, div, mod, pow]
Stack 2 [nand, over, swap, pop, jmp, output(UTF-32)(floor(n) mod 10ffff), func_start, func_finish, input_character_namber_1(UTF-32), input_character_namber_2(UTF-32), ...]
All other stacks
(including negative indices)
Empty

Instructions

All instructions operate on the target stack n specified in the command:

  • Arithmetic (add, sub, mul, div, mod, pow, nand): Pops the top two elements (m=0 and m=1) from stack n, applies the operation, and pushes the result back onto stack n.
  • jmp: Pops the top element of stack n. If it is an integer and a valid line number, execution jumps to that instruction line.
  • func_start / func_finish: Marks the start and end of a function definition block (pushed to Stack 2). When func_start is executed, the instructions up to func_finish are recorded.
  • dup: Not provided natively, as it can be constructed using push-n, over, swap, and pop.

Code Example

function (made by User:Jan_Pilavik)

þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[þ[][]][þ[][þ[][]]]
func_start(番号:7)を実行
... (body)
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[þ[][]][þ[þ[][]þ[][]]][]]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[][]
þ[][þ[][]]=þ[þ[][]][]
þ[][þ[][]]=þ[þ[][]][þ[þ[][]þ[][]]][]]
þ[][þ[][]]=þ[þ[][]][þ[][þ[][]]]
func_finish (番号:8)を実行