~ATH

[WARNING: Spoiler alert for all you Homestuck readers.]
~ATH (pronounced 'til death') is a fictional esoteric programming language that originates from the webcomic Homestuck (found at mspaintadventures.com).It consists entirely of loops that cannot be manually terminated and must instead be terminated by tying them to the lifespan of a number of concepts importable from the language's library. For example, if it were tied to the universe, the loop would be terminated upon the destruction of the universe. It also features only one command (EXECUTE) that can actually be used to execute anything. Unfortunately, this can only be added at the end of a loop, thereby leaving an insufferably long time until the code is executed, depending on what the loop is tied to.
==Tutorial==
:This section is incomplete. User:Vriskanon has offered to work to make it better and include all things found in canonical codes.
While there is no official document anywhere that describes how to use ~ATH, certain consistencies in known programs can be used to guess as to how the program works.
====The simplest possible ~ATH program====
 ~ATH(THIS) {
 //Additional graves...
 } EXECUTE(NULL);
 THIS.DIE(); 
Directly from the source: "~ATH is an insufferable language to work with. Its logic is composed of nothing but infinite loops, or at best, loops of effectively interminable construction. The above page in the intro section documents the simplest possible ~ATH code structure. Any code deviating from this basic structure will not compile."
Although the exact nature of the program is uncertain, it is most likely an infinite loop. THIS is presumed to refer to the program itself, meaning that the program will cease running (as indicated by the THIS.DIE() command) after it finishes the loop predicated upon itself ceasing to run. That would certainly fit with the spirit of the language.
====~ATH====
The ~ATH statement introduces a loop that terminates only when the concept it is bound to dies. 
====THIS====
THIS is presumed to mean the program itself. In this case, the program's execution is tautologically bound to its own lifetime.
====EXECUTE====
The EXECUTE statement executes whatever program is tied to it. It is implied that the execute function may run arbitrary codes and files, which are occasionally represented by animated images (such as Lord English's billiard balls). Unfortunately, an EXECUTE may only be placed after a ~ATH loop. This may be an example of using execute to run a file called 'Hello_World.py':
EXECUTE(Hello_World.py);
Although not explicitly stated, it is presumed that every ~ATH loop must be followed by an EXECUTE function, since EXECUTE(NULL), which likely does nothing in particular, would otherwise be syntactically unnecessary. 
====.DIE====
The die method takes no arguments. It has been used to cease the program and, due to its formatting, may be usable to cease other things (such as subroutines or individual loops within a program, or possibly even importable concepts). It is needed at the end of each program to stop the program, or the loop within which it exists will run forever. To stop something, it is formatted as X.DIE();
X, in this, is the name of the loop or subroutine it is affecting. 'THIS' may be used as X to halt the entire program. THIS.DIE() (or equivalents, in some cases) appears to be mandatory at the end of all programs, even ones which are trivially non-halting. Notably, it is not placed inside the EXECUTE statement.
====import====
The import command is used to import a concept from the ~ATH library. This is most commonly seen to be the universe (which is called 'universe'), but it is suggested that programmers would import incredibly short-lived particles (such as mesons, which decay nigh-instantaneously) if that were possible. "Conveniently absent from ~ATH's extensive import library are entities with short lifespans. Like a rapidly decaying particle that only lasts a millisecond sure would be handy. Or even a fruit fly or something. But no, coding with this language is all about finding ways to trick it into doing what you want." Probably the only easy way to get a ~ATH program to terminate quickly is to bind it to one's own lifetime and commit suicide or to another's lifetime before promptly executing them.
It is unknown if imported concepts need to be specific (such as a particular meson that exists in spacetime) or if the program will simply select an arbitrary one from the present, since all imported concepts so far are unique (universe and author of the program) in the universe. For the simplicity of the example program, it is assumed that the code will select a random concept from the present if there is more than one.
Having imported something, it is given a variable name, such as 'U' for the universe. It may be that imported concepts have set names, but it is more likely that what one calls their concept is completely arbitrary. This is an example of importing the concept of the code's author:
import author A;
For example, if it followed the above statement, this loop would occur as long as its author was alive (or at least until its author died, and yes, these are two very different things in Homestuck):
~ATH(A){
 // More things to do (additional graves) go here.
}EXECUTE(NULL);
====BIFURCATE====
When this is used, the program or root will divide into two separate branches. Sollux used it to divide the program (which is denoted by the code as THIS) into a red and blue half. The program will divide into two separate colors or labels that the user denotes with the function. These act as individual loops (sort of like subroutines) which can be called and manipulated individually. 
Take the following code:
bifurcate THIS[THIS1,THIS2];
bifurcate THIS2[THIS3,THIS4];
This will divide the program into four separate sub-programs.
'THIS' is the entire program and the root of THIS1 and THIS2.
'THIS1' is a single branch of THIS.
'THIS2' is a loop or sub-routine and a branch of THIS made up of THIS3 and THIS4, its branches. THIS2 is thus equivalent to [THIS3, THIS4]. In fact, it may be an error to reference THIS2 directly once it has been bifurcated.
'THIS3' is a loop or sub-routine and a branch of THIS2.
'THIS4' is a loop or sub-routine and a branch of THIS2.
In order to properly terminate a bifurcated program, it must be recombined in [square brackets] and then killed with the DIE():
[THIS1, [THIS3, THIS4]].DIE();
In Sollux's code, the universe is called for both red and blue THISs, suggesting that for each branch of the program, its own individual concepts must be imported. However, without colours to denote what is being imported where, the code has no way to differentiate between imports. Therefore, this page will use the following convention:
 COLOR: means apply this color until the end of the line.
 COLOR/foo means the variable foo in the color COLOR, but without overriding the COLOR: directives.
An example of using this would be:
 BLACK: bifurcate THIS[RED/THIS, BLUE/THIS]; // Split the program into two parts.
 RED: ~ATH(BLUE/THIS) { // Until blue program terminates:
 BLUE:~ATH(RED/THIS) { // Until red program terminates:
 RED: } EXECUTE(NULL); // ~ATH(blue program)
 BLUE: } EXECUTE(NULL); // ~ATH(red program)
 BLACK: [RED/THIS, BLUE/THIS].DIE();
An alternate syntax was devised by a previous editor of the page, but does not allow for the "interlocked-brace" construct used by the Mobius Reacharound Doomsday Virus and the above example.
bifurcate THIS[user,universedeath];
bifurcate user[userlife,userdeath];
FOR(user) {
 import user C;
}
FOR (universedeath) {
 import universe U;
}
In this, the user is imported to the user leaf (which means that it is assigned, undifferentiated, to both userlife and userdeath) and the universe is imported to the universedeath leaf.
====Negative (?) concepts====
In Sollux's virus, there is a line that says:
~ATH(!U2) {
This implies that ! denotes the inverse of an imported concept. In the case of most things, such as the universe, it will simply be the nonexistence of that concept. In Sollux's code, ~ATH(!U2) will occur upon the death of the nonexistence of the universe - which is to say, the start of the universe. (Interpretation of the operator may vary, however.)
====Conditions====
So far, the only conditional statement known is the ~ATH statement. This likely makes programming difficult, which is rather the point.
=====Nested loops=====
Loops may be nested inside the braces of other loops. Loops will only occur if the loop they are in is also occurring. For example, take Karkat's AAAAAAAAAAAAAUUUUUUUUUUUUUUUGH.~ATH code:
import universe U;
import author Karkat;
~ATH(U) {
 ~ATH(Karkat) {
 } EXECUTE(NULL);
} EXECUTE(NULL);
THIS.DIE();
In this, there are two loops. The first is the ~ATH(U) loop, which will execute NULL. The second is the ~ATH(Karkat), which will also execute NULL. The first loop, ~ATH(U), will occur upon the death of the universe. Then, if Karkat's death occurs before the universe ends (or - possibly - even if he dies after the universe ends, provided the program begins running before it does), NULL will be executed. When the universe ends, NULL may be executed again (assuming that the inner ~ATH does not wait for Karkat to die again, which he might).
To make another example, this will execute 'Hello_World.py' if (or each time) an arbitrary meson dies before the end of the universe:
import meson M;
import universe U;
~ATH(U) {
 ~ATH(M) {
 } EXECUTE(NULL);
} EXECUTE(Hello_World.py);
THIS.DIE();
=====Conditions within functions=====
A function (i.e. a subprocedure called from an EXECUTE statement) may also be more ~ATH code. Sollux's virus, he has the following line:
 } EXECUTE(~ATH(THIS){}EXECUTE(NULL));
Given the meaning of the basic "loop forever" program, this presumably means this blue loop will loop until the other program (of the bifurcated pair) dies. 
This also implies that line breaks in the code are largely arbitrary and only used for the programmer's convenience.
==Examples==
An example below is a program written by Karkat Vantas in the comic, which he names AAAAAAAAAAAAAUUUUUUUUUUUUUUUGH.~ATH.
import universe U;
import author Karkat;
~ATH(U) {
 ~ATH(Karkat) {
 } EXECUTE(NULL);
} EXECUTE(NULL);
THIS.DIE();
This is the program used to summon Lord English, a god and major villain in Homestuck, into the universe:
 import universe U;
 
 ~ATH(U) {
 
 } EXECUTE ()
 
 THIS.DIE();
This program will, upon the death of a nonspecific meson, run the program 'Hello_World.py':
import meson M;
~ATH(M) {
} EXECUTE(Hello_World.py);
THIS.DIE();
This program apparently "immediately causes the user's computer to explode, and places a curse on the user forever, along with everyone he knows, and everyone he'll ever meet."
How it does this is unknown, especially since it's supposed to run until the end of not one but two universes. It may have something to do with circumstantial simultaneity, which is a notion of simultaneity which can relate events with no common temporal frame of reference and is very confusing.
 bifurcate THIS[THIS, THIS];
 import universe U1;
 import universe U2;
 
 ~ATH(U1) {
 
 ~ATH(!U2) {
 
 } EXECUTE(~ATH(THIS){}EXECUTE(NULL));
 
 } EXECUTE(~ATH(THIS){}EXECUTE(NULL));
 
 [THIS, THIS].DIE();
==Implementations==
* Implementations of a computable subset of the language with non-canonical semantics exist in several languages. See the PPCG challenge.
* A tumblr user has designed their own strand of usable ~ATH and has created an interpreter for it. Their website is learn-tidle-ath.tumblr.com.
Category:LanguagesCategory:Unusable for programmingCategory:UncomputableCategory:UnimplementedCategory:Concurrent programming