Lindenmayer

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Lindenmayar is a programming language by Calculus is fun (talk) that combines string substitutions with a state machine.
The exact formatting is still being thought over, so please be patient.

Machine

Lindenmayar has a single, arbitrarily long string as memory, and there is a finite number of valid characters, the digits 0-9 can be grouped into integers, and various math operations can be done directly on them during a substitution.

The state machine is then controlled by the substitution system, transitions can be after a single replacement, after a failed replacement, various expressions, or a combination.

Examples

The format here is not official, it's just a placeholder.

Simple mathematics

IN: 5 + 6 * 2

START
<int> * <int> -> ${\1 * \2} ?> START
<int> + <int> -> ${\1 + \2} ?> START
HALT

This code will output "17" when run.

Binary to Unary

IN: 1100

START
1 -> 0* ?> START
SHIMMY

SHIMMY
*0 -> 0** ?> SHIMMY
CLEAR

CLEAR
0 ->  ?> CLEAR
HALT