Yet Another Musical Esolang

From Esolang
Jump to navigation Jump to search

Yet Another Musical Esolang (abbreviated as YAME) is an esoteric programming language that takes music notes as input.

Syntax

Yet Another Musical Esolang uses musical notes and rhythms to represent functions. It behaves as if it has an instruction tape, like brainfuck, and has a pointer that can move and be used to change the values of the instruction tape. At the start, the pointer is at position zero, and all cells are set to zero. The instruction tape is the same as the data tape in brainfuck, but extends to both positive infinity and negative infinity.

Notes and rhythms

Yet Another Musical Esolang uses 13 notes, from E-flat to E-flat an octave above, and 5 rhythms: sixteenth note, eighth note, quarter note, dotted quarter note, and acciaccatura.

Note functions
E-flat E G A-flat B-flat B D E-flat
Sixteenth note accept input of # bytes from user in numerical form, store at position # accept input of # bytes from user in ascii form, store at position # output ascii digit corresponding to number under pointer NOP add # to number under pointer move pointer left # cells NOP begin loop that will be repeated # times
Eighth note move pointer to position # NOP output number under pointer NOP subtract # from number under pointer move pointer right # cells set the number at position # to the current position of the pointer NOP
Quarter note NOP begin loop that runs while the number at position # is greater than # begin loop that runs while the number at position # is less than # begin loop that runs while the number at position # is less than or equal to # multiply # by number under pointer NOP NOP NOP
Dotted Quarter note end program begin loop that runs while the number at position # is equal to # begin loop that runs while the number at position # is unequal to # begin loop that runs while the number at position # is greater than or equal to # divide # by number under pointer NOP set value under pointer to # end loop

Functions in bold require two numerical arguments, and functions in italics require one. Yet Another Musical Esolang uses an octal system to represent numbers.

Values in Octal
E-flat E G A-flat B-flat B D E-flat
0 1 2 3 4 5 6 7

These sequences of notes are compressed into the space of one eighth note, usually using tuples, and placed directly after the function that requires them.

Acciaccaturas

An A acciaccatura is required before the first function, and represents the start of the program.

An F acciaccatura before the note represents that the first numerical argument for the function represented by the note actually represents the value at the position of that numerical argument. Can only be used where this applies.

An F# acciaccatura before the note represents the same thing as an F acciaccatura, but is instead applied to the second argument. Again, can only be used where it applies.

A C acciaccatura means that the first numerical argument is negative. A C-sharp acciaccatura means that the second numerical argument is instead negative.

Measures

Each function or eighth note of numerical input constitutes one beat; each acciaccatura constitutes zero. One measure is always eight beats, including the last, which is buffered with eighth rests. This rule applies no matter how horrible the time signatures get.

Examples

Hello World:

YAME hello world.png

Factorial:

YAME factorial.png

Truth-machine:

YAME truth machine.png

Cat:

YAME cat.png