Share your repls and programming experiences

← Back to all posts
Esoteric Programming Language
ThatSmart (87)

So for Christmas I got The Art of Computer Programming by Donald Knuth, which has an interesting way of defining algorithms. It basically works with states and string substitutions.

Basically, that algorithm says this:
There are N states.
Set j (the state ID) to be 0.
Define σ to be a string.
If the θ value of state j occurs in σ, call the algorithm with the first occurrence of θ in σ replaced with the ϕ, and the j is now the b value. If it doesn't occur, keep the same σ and set j to the a value.

If that makes any sense.
The example program that I wrote finds the gcd of 2 numbers, represented by the amount of as and bs.

The states are listed as j, θ, ϕ, a, b separated by spaces.

The inputs are the word input followed by a string.

Make a program by editing sample.eso in a fork and running. Here's a sample hello world:

0 "" "Hello, World!" 1 1
input ""