aSM

From Esolang
Jump to navigation Jump to search
Alternating State Machine
Paradigm(s) String-Rewriting paradigm
Designed by Asher I
Appeared in 2020
Memory system tape-based
Dimensions one-dimensional
Computational class Unknown computational class
Reference implementation Unimplemented
Influenced by Luigi
File extension(s) .asm


ASM is a low-level programming language that functions by replacing strings and never halts until it has nothing to replace. If it reaches the end of a program, it reloads the code until there is nothing to replace.

Programs start out with a ISO-8859-1 character saying how many characters long after this character the command is and then an ISO-8859-1 character with value 0-3. Read below to know what this second character means.

If second char value of command = 3, you have 16 states to work with and a neighborhood size of 2. If second char value of command= 2, you have 8 states and a neighborhood size of 4. If first char value = 1, you have 4 states and a neighborhood size of 8. If second char value of command = 0, you have 2 states and a neighborhood size of 16.

Programs consist of multiple commands telling the interpreter to replace pair X with pair Y.

The neighborhoods shift (neighborhood size/2) every even command and then shift back every odd command (except 1). You can have it shift back less than the previous neighborhood size by making a command that does nothing with a neighborhood size that is different.

The following parts of the commands are first run-length decoded and then you add to the possible pair value X with X mod (possible pairs for command). The same goes with the encoding of a program. This change makes the programs a lot smaller.

I am absolutely certain you can compile Luigi code (including that turing machine program) to this language, which I am working on.

Examples

Thue-Morse sequence

This program computes the Thue-Morse sequence.

code soon

Infinite loop

This program executes an infinite loop:

code soon