Cathain
Cathain (Irish Gaelic for "when", /kəˈhɪnʲ/ "kah-HIN" or /ˈkahənʲ/ "KAH-huhn") is an esolang created by Nurdle. Inspired by languages like Slashes and Thue, its main function is text replacement, however, instead of text, it's actually bits represented as hexidecimal. It also introduces goto-labels and "timelines".
Syntax
the initial state is ff
there are only 3 commands in Cathain:
Symbol | Description |
---|---|
!(string) |
Define a goto label |
@(string |
Goto a label |
(search) (replace) |
Replace text with something else |
if you try to call a goto label that hasn't been defined then the timeline terminates and returns !!!
Timelines
In Cathain, there are timelines, every timeline is defined by a list of bits, every bit corresponds to one of the commands in the given script.
if a bit is on, then its corresponding command will be run in its timeline.
if a bit is off, then its corresponding command will be ignored.
This does include commands that define a label, if a label isn't declared then the timeline will terminate if it tries to call said label.
Examples
Example Program
This program is used to show how the timeline system works:
ff 0f f a
Output:
timeline 0 (00) 0 FF 1 FF hex: 0xFF string: 'ÿ' timeline 1 (01) 0 FF 1 AA hex: 0xAA string: 'ª' timeline 2 (10) 0 0F 1 0F hex: 0x0F string: '\x0f' timeline 3 (11) 0 0F 1 0A hex: 0x0A string: '\n'
Computational Class
Cathain is widely believed to not be Turing Complete, however its Completeness is unknown. It is at least as powerful as a Finite State machine.
See Also
- Arís - another language that uses time as a core mechanic of the language.
External Resources
- Python Cathain Interpreter by Nurdle