;;;*++
;;;*++ (pronounced "counting") is a completely unusable programming language by User:TBPO.
Paradigm(s) | imperative/functional |
---|---|
Designed by | User:TenBillionPlusOne |
Appeared in | 2025 |
Memory system | cell-based, stack-based? |
Computational class | Unknown |
Major implementations | below |
Influenced by | I/D machine |
Execution
;;;*++ has a tape of cells indexed from 1, each starting at 1, and a stack.
; | Push 1 to the stack. |
* | Pop x and push a value under the cell number x. |
+ | Pop y and x. Set the value under the cell number x to y. Push y. |
When the program reaches the EOF, the stack is cleared and IP returns to the start of the program. Every time that happens, a cycle passes.
Before program execution, interpreter simulates one cycle of the program and reports syntax error if one of these things happen:
- The program tries to pop from an empty stack,
- There are more than 1 values in the stack when IP reaches EOF.
Functional approach
Note that every valid program is a valid tree, with nodes representing instructions, so instead of being stack-based, ;;;*++ can be seen as functional language. Instead of popping values, an instruction takes argument(s) using Reverse Polish notation, and instad of pushing a value, the instruction returns it.
Examples
Counting
This is the smallest and the only known program that does anything useful. It increments the first cell infinitely.
;;;*++
Implementation
Interpreter in Python, using stack-based approach:
def fill(x): global cells while x>len(cells): cells.append(1) # CYCLE EXECUTION def runcycle(n=None): global cells stack = [] if n != None: print(n,cells) for cmd in program: if cmd == ';': stack.append(1) elif cmd == '*': if len(stack) < 1: raise Exception('Too few nodes') x = stack.pop() fill(x) stack.append(cells[x]) elif cmd == '+': if len(stack) < 2: raise Exception('Too few nodes') y, x = stack.pop(2) fill(x) cells[x] = y stack.append(y+1) if len(stack) > 2: raise Exception('Too many nodes') program = input('Program: ') # ERROR CHECKING cells = [] try: runcycle() except Exception as e: print('Syntax error:',e) exit(1) # BODY cells = [] n = 0 while True: runcycle(n) n += 1