CMRA
| Paradigm(s) | imperative |
|---|---|
| Designed by | Chimera418 |
| Appeared in | 2026 |
| Computational class | unknown |
| Major implementations | Python (cmra interpreter) |
CMRA is an esoteric programming language that explores reversible execution using a global direction model. Programs execute either forward or backward through their instructions, and control flow is achieved by dynamically changing this direction.
CMRA has two syntactic variants with identical semantics: Fire Dragon (expressive keywords) and Shadow Dragon (minimal syntax).
Overview
CMRA programs are executed line by line using a global direction variable. By default execution proceeds forward, but instructions can reverse the direction of execution, causing the program to traverse its code in reverse order.
This model enables the construction of loops and control structures without explicit loop constructs.
Execution model
Execution is controlled by a global direction value:
- Forward: execution proceeds from top to bottom
- Reverse: execution proceeds from bottom to top
The program terminates when the instruction pointer moves past the first or last line.
Certain instructions modify direction:
- Fire Dragon:
dive— sets forward directionsoar— sets reverse direction
- Shadow Dragon:
reverse— toggles direction
Block conditionals behave differently depending on direction:
- Forward entry → execution begins at the first line of the block
- Reverse entry → execution begins at the last line of the block
Syntax
Fire Dragon (.cmra)
- Assignment:
bind - Output:
roar - Conditional:
sniff - Direction control:
dive,soar - Comment:
murmur
Example:
x bind 3 sniff x < 5 : roar x
Shadow Dragon (.cmrash)
- Assignment:
= - Output:
print - Conditional:
check - Direction control:
reverse - Comment:
;
Example:
x = 3 check x < 5 : print x
Control flow
CMRA does not include built-in loop constructs. Instead, loops are formed using direction reversal, conditionals, and flag variables.
Inline loop pattern
i bind 0 flag bind 1 sniff i < 5 : sniff flag == 0 : dive flag bind 0 sniff flag == 0 : roar i sniff flag == 0 : i bind i + 1 flag bind 1 sniff i < 5 : sniff flag == 1 : soar
Block loop pattern
i bind 0
flag bind 0
sniff i < 5 :
{
sniff flag == 1 : dive
sniff i < 5 : flag bind 1
sniff flag == 1 : roar i
sniff flag == 1 : i bind i + 1
sniff i < 5 : flag bind 0
sniff flag == 0 : soar
}
Data model
- Numbers are treated as floating point values
- Strings support concatenation using
+ - Variables are globally scoped
- Expressions follow standard arithmetic precedence
Computational power
CMRA supports conditional execution and unbounded iteration through direction reversal and flag-based control flow. Programs can revisit instructions multiple times by changing execution direction, enabling loop-like behavior.
The computational class of CMRA depends on the available memory model and interpreter constraints. In typical implementations with unbounded variables and control flow, it is capable of expressing general computation.
Implementation
CMRA is implemented in Python and provides:
- Source repository: https://github.com/Chimera418/cmra
- Python package (PyPI): https://pypi.org/project/cmra/
- Documentation website: https://cmra-esolang.vercel.app/index.html
- Online playground: https://cmra-esolang.vercel.app/playground.html
- VS Code extension: https://marketplace.visualstudio.com/items?itemName=Chimera418.cmra-esolang
- Open VSX extension: https://open-vsx.org/vscode/item?itemName=Chimera418.cmra-esolang
Reference implementation
The reference implementation of CMRA is written in Python and supports both Fire Dragon (.cmra) and Shadow Dragon (.cmrash) dialects.
Installation
CMRA can be installed via pip:
pip install cmra
Usage
Run a CMRA program using:
cmra program.cmra cmrash program.cmrash
Alternatively, using Python directly:
python -m cmra program.cmra
Example
roar "Hello, Chimera!"