QuantaScript
QuantaScript is an esolang made by Google Gemini prompted by Cyclic Tag. The language operates exclusively on a single stack that can hold values in one of three states: 0 (False/Down), 1 (True/Up), or ? (Superposition).
Concepts and Data
QuantaScript's primary data unit is the Qubit. Unlike traditional binary, a Qubit can exist in a state of superposition represented by the character ?.
Qubit States
0: Definite False state.
1: Definite True state.
?: Superposition state.
The core mechanism of the language is the Collapse operator, which forces all Qubits in superposition (?) to resolve to a definite 0 or 1 based on the parity of the non-superposition Qubits currently on the stack.
Instructions
QuantaScript is a minimal language with only seven instructions, focusing on stack manipulation and state transition.
| Instruction | Character | Description |
|---|---|---|
| Push 0 | 0 |
Pushes a definite '0' Qubit onto the stack. |
| Push 1 | 1 |
Pushes a definite '1' Qubit onto the stack. |
| Push Superposition | ? |
Pushes a '?' Qubit onto the stack. This Qubit is non-deterministic until collapsed. |
| Collapse | ! |
Forces State Collapse. Calculates the parity (XOR sum) of all definite Qubits (0/1) on the stack. All '?' Qubits on the stack immediately resolve to that parity result. The stack is unchanged otherwise. |
| Entangle Jump | ~ |
Conditional jump. Pops the top Qubit. If the popped Qubit is 1 or ?, jump to the matching ~ instruction ahead. If the popped Qubit is 0, continue execution normally. Used for looping and conditional logic.
|
| Output | . |
Pops the top Qubit. If it is 0 or 1, prints the ASCII character corresponding to the Qubit's value (0=NUL, 1=SOH). If it is ?, the program terminates immediately. |
| Swap | ^ |
Swaps the top two Qubits on the stack. If the stack has fewer than two elements, the program terminates. |
Turing Completeness
The Turing completeness of QuantaScript is hypothesized but remains an open problem due to the non-deterministic nature of the state collapse (!) operator, which depends on the stack's history and current contents. Simple state machines can be constructed using ~ for branching.
Examples
Hello World
This program is impossible in QuantaScript due to its limited output capability (only ASCII values 0 and 1). However, the following program demonstrates the collapse mechanism by outputting a '0' then a '1'.
0 1 . .
Basic Collapse Demonstration
This example pushes two definite '1's, which creates an even parity (1 XOR 1 = 0). When the stack collapses, the '?' resolves to a '0'.
1 1 ? ! .
Explanation:
1: Stack is [1]
1: Stack is [1, 1]. Parity is 0.
?: Stack is [1, 1, ?]. Parity is still 0.
!: The '?' collapses to '0'. Stack is [1, 1, 0].
.: Pops 0 and prints NUL (ASCII 0).
Cat Program (Input/Output placeholder)
QuantaScript currently lacks a defined input mechanism. A hypothetical version of the Cat program (that outputs a pre-defined sequence of alternating Qubits) is shown:
1 0 1 0 . . . .