Bitoven
Bitoven (derived from Beethoven) is a programming language by User:Imaginer1 in early September 2014, with the goal of making a musical programming language focusing more on free expression in its musical format and ability to play readily rather than exact and definitive notes (that is, a single program can have many different musical representations.) He currently welcomes anyone's recommendations about the language- If you have questions or recommendations please put them in the talk page! The current EOF convention should probably be 0.
Textual Form
Bitoven is easily written in textual form and consists of the following characters.
Symbol | Usage |
---|---|
Letters a...z and A...Z | Case-sensitive registers that hold values of 0 to 255, with wraparound. |
Square brackets: [] | While loops: [m {code} ] runs the code within the brackets while the value of register m is nonzero. It will run the entirety of code within it before performing the check on m. |
? and ! | Input and output: m? sets the value of register m to the ASCII value of the provided character and n! prints the ASCII character of n to the screen. |
+ and - | Adds to or subtracts from a register in unary. m+++ adds three to register m; n---- subtracts 4 from register n. |
Musical Form
In musical form there are far more registers than in the textual form, as any set of 3 or more notes that can be played simultaneously is a register, octave-sensitive. Call the lowest note in the chord the 'home note'. To convert to musical form:
Feature | Musical form |
---|---|
Registers | Registers are simply chords that are played in almost all the same places as in textual form, with the exception of while loops. |
While loops | To begin a while loop that executes code while a register is nonzero, play the desired register chord as an arpeggio. Play this arpeggio again to terminate the while loop. IF you wish to nest while loops within while loops of the same register, alternate between up and down arpeggios and ensure they are properly matched. |
Input/output | For input, play a set of multiple lower notes simultaneously followed by multiple higher notes simultaneously, where if these notes were all played simultaneously they would reference the desired register. For output, play the higher notes before the lower notes. For example if you wish to play an input on the chord CEG, play C as a whole note. While C is still playing, but after at least one rest, play E and G simultaneously. |
+ and - | To add a value to a chord, play the chord followed by a note higher than the home note if you want to add and a note lower than the home note if you want to subtract. Continue to however many notes you want to add or subtract, and terminate it either by playing the home note again or by playing the entire chord again. |
Let's try to analyze a sample program with this setup to show how it could be read by a sort of state machine.
- First comes the area in cyan, labeled with a 1. This is a chord- therefore we start to parse as adding or subtracting from the associated register, register CEG. We'll initiate a zero 'accumulator' as we determine how much we are adding or subtracting from register CEG.
- Then comes the green area, labeled with a 2. The 'home note' of our CEG chord is C, and the first note of these three is a high B. Since this is higher than C, we are adding.
- Still in the green area, the next note is not the home note, so we add one to the accumulator to give a value of 1.
- Still in the green area, the note is C, which is the home note of CEG, so we stop. The beginning of the program is to add the value of 1 to register CEG.
- Now in the orange area labeled with a 3, the interpreter reads a single note. Since the only possible thing here is an arpeggio or input/output, it continues reading.
- The next note is a single note, so we have an arpeggio.
- We have a third note, and the arpeggio matches the notes of our register, so we have a while loop starting: 'While the value of CEG is unequal to zero'.
- Now in the purple area labeled with a 4. The first note read is a single note so the only possibility is an arpeggio or input/output: the next notes read, however, are simultaneous with the first one. That is, at some point C and E and G are played though not at the same time. This is an input call.
- Now in the red area labeled with a 5, a similar process leads to the conclusion that we output to stdout.
- With the same reasoning as in the orange area we determine that the last region is for terminating the while loop.
Example programs
a?b?[aa-b+]b!
Adds two numbers. If the input file was '22' or '(<' it would output the letter d, for example, as the ASCII value of '2' is 50, the ASCII value of '(' is 40, the ASCII value of '<' is 60, and the ASCII value of 'd' is 100.
If EOF = 0, then the cat program is
a+[aa?a!]
if EOF = -1, then the cat program is
a+[aa?a!a+]