cirt e mys

From Esolang
Jump to navigation Jump to search

cirt e mys is an Esolang created by User:Yayimhere as a more well thought through successor to Apraxia. As such, it is also pattern based. It uses a more sophisticated, though strange syntax. Unlike Apraxia, no special meaning is assigned to something like "the last symbol of the program". cirt e mys also had the secondary goal of being more balanced between halting and looping. Just like its mother language Apraxia, it is functionally pure.

Etymology

cirt e mys is named after noit o' mnain worb, and specifically, when reversed, it reads as symmetric, based on how symmetric strings affect the programs

Notation

cirt e mys is built on top of a special string rewriting notation. And as such, it will be described here:

  • x': reversed x.
  • x^: x without its first character(empty string if single character).
  • x-: first character of x.
  • x+y: concatenation.
  • x*: (x'+x)^ or x'^+x.

these cannot actually be used in the program.

Expression elements

cirt e mys programs are all expressions(specifically, a strange form of S-expressions). Brackets are substrings of length >1, that "match" with their reverse. Meanwhile, the objects are simply (greedily matched) strings that dont match with anything. Note that brackets can "overlap", like for example:

abc ... ba ... cb

as you can see, abc acts as the left bracket for two other substrings. As such, the substring between abc and ba is c ..., and between abc and cb is ... ba .... These brackets are called "bracket snapshots", and non brackets are called "nodes". Note that brackets always match with their closest possible match, thats not taken my another bracket thats closer. In the special case of a program made up of only a single character, it isnt matched as brackets. However, aaa ... aa ... aa is matched, as long as the ... doesnt end or start with a. Also, "longer" brackets are preferred. Brackets can have empty strings as their inner content.

Rewriting rules

cirt e mys uses two types of rewriting rules, one for bracket snapshots and one for nodes. These are defined as:

bracket snapshots: b x b' -> (x^-+(x^^-))'+(b^)+(x-)+(x')
nodes: x p -> p+x* (note that p is the rest of the program, after the node ends)

these are applied left to right. When a rewrite has been applied, the whole program is reinterpreted and another rule is applied, and so on until the string stops changing. Note that this check only goes step by step. If one step doesnt actually change then string, the condition is met, but it does not apply to the whole history of the program.

Demonstration

The program:

abvcvcba

Evaluates as:

ccbvcvcv
vcvcvccccb
cvvccccb
ccccvvccvvccccb
cccvvcb
cvvcbccc
vbccc
ccbvvbccc
cbvc
vbccbvc
bcc
cbbcc
bc
bbc
bbbbc
...

Emergent behaviour

cirt e mys' rewriting rules often destroy one bracket match, and create another, in two steps(first bracket snapshot rewrites, and then nodes). I dont really know why this happens but it's interesting.

Examples

Looping counter(*2-1):

**

or if you purely want *2:

*>

Halt in one rewrite:

abba

Halt in zero rewrites:

a

Decrement a counter *|(which later becomes *.) and increment again:

*|ababazxzxz;.ababa

relevant steps:

*|ababazxzxz;.ababa
ababazxzxz;.zxzxz**|
*.;;zxzx.aaa
aa.xzxz;;.**.;;zxzx.aaa

AND, the counter ; gets incremented, and then doesnt change.

only decrement the k counter(s) on every odd cycle:

kkk|.kk|

decrement the length of the string on every cycle until v**|bx:

*|abbazxxzvnnv

any number of brackets can be added to the right as long as they use unique characters.

Computational class

Cirt e mys' computational class is currently unknown. However, there are two lower bounds known. Obviously Cirt e mys is more powerful than an FSA, because of the above looping counter. However, less obviously, if we treat the program as a stack Cirt e mys is more powerful than a PDA, shown by the decrementing program above(*|abbazxxzvnnv)