DAWBridge
DAWBridge is the ultimate challenge for those that are programmers, musicians, and masochists simultaneously. It was made by User:BoundedBeans.
Etymology
A "DAW" is a Digital Audio Workstation. (Ableton Live is one, and this language attempts to compile an Ableton Live project (although it may not succeed).) The name is a pun on "drawbridge" (while the language has absolutely no connection with drawbridges, it does act as a "bridge" to a "DAW", even if in a very uninteractive way).
Syntax
DAWBridge is column-dependent, like COBOL. The difference is that each part of the line is a completely different programming language.
Each column group can have the last two characters be ->
. This grants access to the next line, removing the ->
and concatenating the lines. It is possible to do this multiple times to gain many more lines. INTERCAL statements continue. The 2D language's grid will expand to contain more columns the instruction pointer can go to (though it won't affect the column structure of code being modified by any language. If not all lines of 2D language have the same number of continuations, the shorter ones are treated as if they are padded with spaces). Note that all other column groups do not count towards their group. However, they must be specifically filled with the URL encoded form of the previous line in their group, looping and truncating if necessary. Each line continued adds another layer of URL encoding onto the result of the previous line. To continue multiple column groups, the last two characters of one of the URL-encoded parts should be ->
instead.
1 1->2 2 23 3 3 1 1 .2%2->3%203 1%2012 2->3%252 1%2522 2 .3%2-> 1%2522%2023 3 . NOTE:CG1 = NOTE:"1 1 1 1 ." NOTE:CG2 = NOTE:"2 2 2 2 2 2 ." NOTE:CG3 = NOTE:"3 3 3 3 3 ."
(The above program is not syntactically correct (the columns are mockups))
The amount of rows can be modified, but only by INTERCAL. The length of a row can be modified by either (INTERCAL will always modify all rows). Rows are always at least 35 characters long, but longer lines can occur with extensions. Every row can be assumed to have an infinite number of spaces to the right. When forming a matrix out of the code (such as when INTERCAL WRITES IN ,2023
), the row length is the shortest length that can fit all non-space characters on all lines while having an equal row length for every row.
Modifying a line continuation will work, and the URL encoding is not checked when self-modifying. However, removing the arrow will remove the continuation effect, causing them to behave as separate lines. Note that INTERCAL statements in this language must always have a one-to-one correspondance with the total of a line and its continuations.
Columns 1-20 are used for a single INTERCAL-72 statement (not including NEXT
, RESUME
, or FORGET
), along with the extra features of CLC-INTERCAL's Baudot and Binary I/O, and a DO GOTO [label] IF [expression]
statement which checks if the expression is nonzero (implementations are free to add custom statements). A statement must include DO
or PLEASE
to be run, although if it doesn't, it will act exactly like a runtime syntax error in standard INTERCAL, since each line is a separate statement. The INTERCAL statements collectively remember their environment, keeping all variables, stashes, etc. between them, but lose it at the end of the cycle. READING OUT
the matrix ,2023
modifies the entire codebase to it and doesn't output anything, with each line being a separate row (including line continuations as a separate row in the matrix), and WRITING
it IN
gets the new contents, not the one executing, so READING
it OUT
, then WRITING
it IN
will get the value READ OUT
If any error is thrown from INTERCAL, the message is printed but the code continues executing and the statement is not executed. This is to ensure that the only way a program will halt is by not self-modifying.
Columns 21-30 comprise a small 2D programming language with the following instruction set:
Command character | Action |
---|---|
><^v |
Befunge-style arrows |
S |
push an empty string to the stack |
' |
Append the character to the right of the instruction pointer to the top string. If there is no top string on the stack, put the string "DON'T EVEN TRY." onto the stack, and append the character. |
+ |
Print the top string on the stack. |
% |
Save the current coordinates onto a stack of coordinates which can be returned to later, then act like ^ . When returned to, act like > .
|
= |
Pop the top element off of the coordinate stack and return to it. |
[ |
Pop the top element off of the coordinate stack and change the contents of that line to the top string on the stack. |
2 |
Pop two strings off of the stack representing numbers, append the character at those coordinates (y on top) in the total code (including INTERCAL, this, and Ableton xml, as well as any custom column groups) to the top string. |
: |
Pop the top two strings. If they are equal, skip the instruction pointer past the next instruction. |
J |
Check if an input queue is empty, if it is, input a line into the queue. Dequeue one character from the queue and push it as a string. |
] |
Skip the instruction pointer past the next instruction. |
E |
proceed to the next iteration |
_ |
Pop two strings, concatenate them. |
- |
Duplicate the top string on the stack. |
The 2D language will not escape its area of columns, but it can modify the other bits.
Columns 31-35 comprise an un-gzipped Ableton Live project file. (Ableton Live is an advanced program for creating music.) The un-gzipped form is just XML, but with such a tiny line length, it will be very difficult to put the program literally.
Semantics
The INTERCAL program runs first, causing whatever effects to happen. The contents of the variables are not saved, but since ,2023
can be read for the contents of the code, that can be used as data storage. If INTERCAL modifies the code, the modifications do not take effect until the 2D language is started for the cycle.
After the INTERCAL program finishes, the 2D program begins with similar qualities, losing all data once finished. If it modifies the code, it only takes effect when INTERCAL starts again. (INTERCAL might need to be decompiled at this point.)
Then the cycle repeats until both programs perform no self-modification in an iteration (reflection is not counted as self-modification). After that, the xml is extracted from the Ableton section, gzipped, and outputted as an Ableton project file. Ableton should automatically and immediately open the project file, unless it can't (the project file may be invalid or Ableton cannot be located), in which the program should print Are you serious right now?
to the console.
Extra column groups
The program may have any number of additional column groups, listed after the Ableton project. They all are 15 characters wide. Before it starts, 5 characters should contain a unique identifier for the group type. It must be repeated on every line using them, including continued lines (the identifier should never use URL- encoding). This allows custom implementations to define extensions in their own way while programs without them can be portable, and also so that custom extensions can be implemented in multiple interpreters and be portable between them. A "column group" with a name containing 5 spaces is not really a column group, but the lack of one, and terminates the list of column groups. This termination rule is also way to have infinitely long single-line comments.
The selection and order of column groups can be different on each row. As an exception, if a line extension is used on any column group (including vanilla ones), it is required that the selection and order be the exact same.
In the case that not all extensions are used on a line, the 15 characters other than the group name are implicitly all spaces, without a line continuation.
If a group runs in a separate part of the cycle from INTERCAL and the 2d language, it will only run if the group is specified somewhere in the program. Self-modifying can put it in the program, which will cause it to run.
The column groups NOTE:
and all column groups of the form @IG/X
where X can be replaced by any character is reserved to have completely no meaning as a comment.
Any column group beginning with @
is reserved for further official additions.
Examples
Hello, world
DO ,1 <- #18 v <?x-> DO%20%2C1%20%3C-%20%v%20%20%20ml -> DO%2520%252C1%2520%2v%2520%252ver-> DO%252520%25252C1%25v%252520%2sio-> DO%25252520%25252C1%v%25252520n="-> DO%2525252520%252525v%252525251.0-> DO%252525252520%2525v%25252525" e-> DO%25252525252520%25v%25252525nco-> DO%2525252525252520%v%25252525din-> DO%25252525252525252v%25252525g="-> DO%25252525252525252v%25252525UTF-> DO%25252525252525252v%25252525-8"-> DO%25252525252525252v%25252525 st-> DO%25252525252525252v%25252525and-> DO%25252525252525252v%25252525alo-> DO%25252525252525252v%25252525ne=-> DO%25252525252525252v%25252525"ye-> DO%25252525252525252v%25252525s" -> DO%25252525252525252v%25252525?> DO ,1 SUB #1 <- #20 v <!-- DO ,1 SUB #2 <- #31 v ----- PLEASE ,1SUB#3<-#1 v ----- DO ,1 SUB #4 <- #19 v ----- DO ,1 SUB #5 <- #19 v ----- DO ,1 SUB #6 <- #24 v ----- PLEASE ,1SUB#7<-#27 v ----- DO ,1 SUB #8 <- #12 v ----- DO ,1 SUB #9 <- #4 v ----- DO ,1 SUB #10 <- #31v ----- PLEASE,1SUB#11<-#18 v ----- DO ,1 SUB #12 <- #31v ----- DO ,1 SUB #13 <- #24v ----- DO ,1 SUB #14 <- #10v ----- PLEASE,1SUB#15<- #19v ----- DO ,1 SUB #16 <- #9 v ----- DO ,1 SUB #17 <- #27v ----- DO ,1 SUB #18 <- #13v ----- PLEASE READ OUT ,1 v ----- DO GIVE UP E -->