Roughly 4 years ago, I mentioned that there appears to be an esotieric
programming language which shares my full name.
I know, it is really late, but two days ago, I discovered Racket.
As a Lisp person, I immediately felt at home.
And realizing how the language dispatch mechanism works, I couldn't resist
and write a Racket implementation of MarioLANG. A nice play on words
and a good toy project to get my feet wet.
Racket programs always start with #lang. How convenient.
MarioLANG programs for Racket therefore look something like this:
So much about abusing coincidences. Phew, this was a fun weekend project!
And it has some potential for more challenges. Right now, it is only an interpreter,
because it appears to be tricky to compile a 2d instruction "space" to traditional
code. MarioLANG does not only allow for nested loops as BrainFuck does,
it also includes weird concepts like the reversal of the instruction pointer direction.
Coupled with the "skip" ([) instruction, this allow to create
loops which have two exit conditions and reverse code execution
on every pass. Something like this:
@[ some brainfuck [@
And since this is a 2d programming language, this theoretical loop could be
entered by jumping onto any of the instruction inbetween from above.
And, the heading could be either leftward or rightward when entering.
Discovering these patterns and translating them to compilable code
is quite beyond me right now. Lets see what time will bring.