Auld Lang

From Esolang
Jump to navigation Jump to search

Auld Lang is a joke esoteric programming language created by Dom Davis. It is similar to Brainfuck, although some instructions allow for arguments, and the looping structure is different. Auld Lang was created in reaction to a tweet which played on the fact that the phrase "Auld Lang" (from the poem "Auld Lang Syne") followed a similar naming format to golang, dlang and erlang. Since Auld Lang didn't exist it was created with the sole purpose of making the poem executable. Sufficient ambiguity has been added into the interpretation of the poem to allow for the fact that it produces no meaningful output when run through the Auld Lang interpreter.

Memory

Auld Lang is cell based, with a single cell memory allocated when a program starts. Programs can destructively alter the memory size during execution, a trait that is used to implement the "Auld Lang Sine" pun example. Memory is treated as a contiguous loop with the pointer resetting to the end or beginning of the memory if an under or overflow would happen.

Commands

Auld Lang has two classes of command. Each line contains an instruction, which usually takes an argument, and an optional terminator which will run an additional instruction. These terminators are similar to Brainfuck. Commands follow the form command[.!?,;]?\n with the optional characters at the end of the command being the terminator. Auld Lang is case insensitive.

Arguments

Some instructions in Auld Lang take an integer argument. These always take the form instruction (.*?)[.!?,;]?\n. The argument is the count of characters in the capture group. Since arguments are character counts Auld Lang has the potential to be very wordy. It also allows for, and promotes, inner artistry.

Comments

Auld Lang does not allow for comments. Arguments should be constructed in such a way that they document the code.

Terminators

Brainfuck Auld Lang Terminator Description
> ! Move the pointer to the right
< ; Move the pointer to the left
+ , Increment the memory cell under the pointer
- . Decrement the memory cell under the pointer

The terminator ? reads input from stdin but instead of reading a single character and storing it it reads a line of characters and stores the character count.

Instructions

Command Description
Happy <arg> Set the memory to the size of the argument. This deletes existing memory. The argument cannot be 0.
Should auld acquaintance be forgot Repeat the next line until the memory cell being pointed as is 0.
For auld lang syne <arg> Output the value in the current cell, move the pointer to the left by the amount given in the argument.
Sin auld lang syne <arg> Output the value in the current cell, move the pointer to the right by the amount given in the argument.
We'll <arg> Decrement the current cell by the amount given in the argument.
And <arg> Increment the current cell by the amount given in the argument.
Frea <arg> Move the pointer to the right by the amount given in the argument.
We <arg> Jump (to after the next "But", or the end of the program) if the current cell is less than the amount given in the argument.
But <arg> Jump (to the previous "We", or the start of the program) if the current cell is less than the amount given in the argument.
Kevlin Dump state after every instruction.

Hello, world! program

Happy New Year World!
Frae the new year!
And me to you!
And great tidings o'er all the world

We wish greetings all
Frae o
And no matter how small sing "Hello"
But we cannot sing for all of the day'o

We'll sing tidings to all to great and to small!
And include all of this world in our singing!
And simple it may be
And rhymes you can see
And yet this syntax really limits us so!

And so blocks of text appear
And we've forgot the new year
And we fiddle the register here!

And so blocks of text appear
And we've forgot the new year
And we fiddle the register here!

And although all is not lost
And though many lines be the cost
And the language gets embossed!

And these chains!
Frae o

And while this pentameter is off
And we can do nothing but scoff!

And although all is not lost
And though many lines be the cost
And the language gets embossed!

And as the end it comes near
And we thought yes, o-dear,
And we figured we could do this in tune!

And have the structure the same
And use the tune again
And copy that that inspired us here!

And my prose they are lacking
And I may be slacking
And "brute forcing" this a lot!
And o!
Frae o

Should auld acquaintance be forgot
Sin auld lang syne o

External resources