I have completed the syntax explanation post, and I think it is fairly clear now.
If you find any part of the post to be unclear, and that it requires further explanation, please say so so that I can improve it.
Now that that post is in an acceptable form, We can get on to writing our first few ~ATH programs.
print Hello, World.; THIS.DIE();
That wasn't so hard, was it?
I feel I should note that the syntax of the print command is not entirely finalized, it might change sometime later.
EXPLANATION:
The first line of the program says to output the text "Hello, World."
The 2nd line of the program says to end the program. This is because the variable THIS initially points to a object that is only alive when the program is running. If the object is ever not alive, the program stops.
oh gosh why is this a bullet-ed list I am not good with tumblr
To run a drocta ~ATH program, you need the interpreter (available from the github), and python 2.7 (the interpreter can be easily modified to run with python 3, but it is written to work in 2.7)
Open interp_2.py with python, and when the program comes up, type in the filename of the ~ATH program, and hit enter, this will run the ~ATH program.
With this example, it should output the text
Hello, World.
Now, of course, this is a relatively simple program, but at least its something.
Depending on how you are running the interpreter, the program might close immediately after outputting the text.
That might not be what we want.
To make the program not close until we specifically tell it to, we use the following:
print Hello, World.; ~ATH(THIS){ } THIS.DIE();
EXPLANATION:
The first line is the same as in the first program. It outputs "Hello, World."
The second line is different, this says to start a loop, which will continue until the object pointed to by the variable THIS is dead.
The third line says to go back to the corresponding ~ATH statement.
The fourth line is never executed, because the loop above it will continue until the object pointed to by THIS dies, and if that object dies the program ends. If it were to be executed it would make the object pointed to by THIS die, and the program would end as a result.
This program should be the same, except that it will keep running until you close it manually.
Now you have hello world written in two different ways!
okay, this might be a liiittle specific, and more HS oriented, but still. can you power a First Guardian using ~ATH? and if so, what are some ways?
This is a slightly off of the usual topic of this blog, which is more about a language which I made up and is based on and named after the language in the comic, and attempts to be as close to the comic while still being possible to implement and use, (the language in the comic is not particularly well documented), but I’ll answer it to the best of my abilities.
I’m not sure what you mean by “power”.
“Can I write a first guardian character that has some of their behavior be based on ~ATH in some ways?” : I don’t see any reason why not. If you can do ectobiology with a puppet and a cueball, why not with a computer running a program?
“Can I make a first guardian character who is a first guardian because of the continual execution of a ~ATH script?” : While you can of course write whatever you want, I’m not sure that this is consistent with what is said in acts 1-7 (I have chosen to disregard everything after act 7) about first guardians. It seems like an entity either is or is not a first guardian, and that this fact is established at the time of that entity’s creation. It seems to me like what happens with first guardians is: using ectobiology, the genetic code from some players’ subconscious-or-whatever is combined with some other source(s), and the result is a first guardian.
Oh, I suppose if you just mean “an entity has the powers of a first guardian as a result of a ~ATH script”, then, uh, I guess that doesn’t contradict anything. How would I depict such a script? Well, I don’t know that anything that we’ve seen of the language gives any particularly clear direction for what such a script would look like. If you want it to just have the keywords we’ve seen, possibly re-interpreted to mean something different, I guess one idea could be to like, say bifurcate an existing first guardian into parts with names that seem relevant, and also whatever entity is to have the abilities of a first guardian, and then like, un-bifurcate (unbifurcation is not something shown in the comic, but is something I’ve added to my language, in order to make it usable) the other entity, but with some component of the first guardian mixed in somehow? Though if you did that, you would probably want to justify why, if ~ATH can do that that easily, why it doesn’t happen all the time.
There is very little in terms of rules that the story gives for how ~ATH behaves. If you want to have a ~ATH script “power” a first guardian, just make up some stuff. If you want to depict the actual script, then look at all the pages of the comic that depict code from it, see what it says they do, and just make something up that seems to aesthetically fit.
The language that I have defined (”drocta ~ath”) does not provide any means of doing this, because the language I designed was designed to technically be usable, while also resembling the language in the comic.
I suppose that, as all first guardians get their power from the green sun, and the green sun was created by the circumstantially simultaneous destruction of, uh, either universes A and B, or specifically of A2 and B1, not sure which, and this was in some ways tied to the Möbius Double Reacharoud virus, you could argue that all first guardians get their powers from, something somewhat connected to a ~ATH script.
Why can’t I add tags to an answer to an ask?
I am still here, and I am wondering what my update schedule for this tutorial should be.
Its been a week or two since I last posted part of the tutorial, so I feel like I probably should have posted during that time, but I haven't.
I will probably post one today.
Do you have any suggestions for what type of update schedule I should keep on this tutorial?
Do you know of any ~ATH implementations or dialects besides yours and mine?
Actually, yes kinda. Sorta anyway. There is a compiler of sorts that is intended to be ~ATH based, though I don't think it matched canon all that well.
It did have one feature which I found interesting though. It had a command which would create a variable thing which was truthy iff there was a process currently running with a given name, so you could have in a ~ATH loop something that loops until another program is closed. It was a pretty cool feature, but the syntax for it was odd. The author misinterpreted the panel where Sollux deletes the different virus folders he had, so the command was called rm -rf or something like that.
It also had a command to run an executable (by file name) iirc.(which allowed for easy implementation of the robin hood and friar tuck programs)
It also was an editor of sorts, but it had a small window that I don't think was resizeable. It worked (iirc) by doing some string replacement to turn the program into a c(++?) program, which it then compiled.
I'll try to find it so I can link it. I don't think it represents ~ATH all that accurately, but the using another program as one of the objects seemed like a neat and probably accurate feature (given the mobius double reacharound)
tl;dr yes
So recently I started kind of working on this again for a bit. I have fixed some bugs with the parser that I haven't pushed yet. I am also writing an improved interpreter that will use the parser instead of the hacky thing that just goes through strings.
However, for the time being, even after I release this version, I would recommend maybe using the older version for a while if anyone is using it, because this version is probably even more buggy.
However, you know how a few posts ago (but more than a year ago (wow) ) I posted that post where I said that I didn't think bifurcate can be used to split values into more than 2 values?
Well I still kind of think that, but on the map page for homestuck on act 6, it says split Act_6[Act_1,Act_2,Act_3,<etc>];
So this is something I intend to implement, and something I am implementing.
And like I said before I would like it to be done with repeated bifurcation, as a sort of syntactic sugar.
And I am thinking I want it to be like
[a,b,c] means the same thing as [a,[b,c]]
so split Z[A,B,C];
would be the same as
BIFURCATE Z[A,BCTEMP]; BIFURCATE BCTEMP[B,C];
and that split [A,B,C]Z;
would be the same as
BIFURCATE [B,C]BCTEMP; BIFURCATE [A,BCTEMP]Z;
But the way the splits would be done could also be backwards
so [a,b,c] could be the same as [[a,b],c]
I'm pretty sure I prefer the first way, but the second way is actually easier to implement.
or at least cleaner looking to implement.
Why doesn't my code look clean ever?
Anyway, my reason for this post is this:
Does anyone have any opinions about how split is implemented?
I couldn't help but notice that out of some of the best things you could do, no link to the download in the sidebar? You may want to do that...
uh, yes. that would be good to do.
I put a link in the about section, but I don't actually know how to put links in the sidebar outside of that.
do you think you could explain that for me?(I am not particularly experienced with tumblr)
EDIT:Nevermind, my friend from school told me where the feature is.
PRINT2 prints a string object as a string. If you give it something that is not a string object it will probably crash, or output the empty string.
Now, to import user defined functions use
importf filename as FUNCTIONNAME;
Why didn't I put this up earlier?
because I have other projects and because sometimes I am busy/lazy.
OK!
So to make a function to import, you pretty much make a ~ATH file like normal, except the object passed into the function is put into the variable ARGS, and when you want to pass the output object of the function out, you have it as an argument to the DIE method.
It can either be when saying THIS.DIE(RETURNOBJ); or ANYOTHERVARIABLE.DIE(RETURNOBJ);
The object your killing doesn't have to be the one tied to the life of the function or anything.
Oh I should clarify, the THIS variable/object will refer to the current function, not the file that called it.
It CAN be returned, and will be dead when you exit the function.
PROGRESS!
FUNCTIONS WORK.
LESS SPAGHETTI CODE.
although this starts to make me wonder if maybe this strays too far from what ~ATH is like in comic,
but w/e.
(no features added, but cleaned up some code and added example programs)
yup.
it has the basis for how I am going to make functions if I make them, and cleaned up the code for BIFURCATEion, and removed some lines that were commented out.
if you want the new version it is on the github.
no real difference when it runs though.
(if something you wrote doesn't work with the new version, try using BIFFURCATE instead of BIFURCATE to use the old code. You probably won't need to, though. It works fine for me. and you probably haven't written anything in it anyway, because you kind of have to uh, want to, I guess)
How do you use this?
Just to be super clear, though you probably understand this, “drocta ~ath” is not for practical purpose. It is purely an amusement.
That being said, to run this, you need to have python 2 installed. (Yes, currently most new python projects are in python 3. Unfortunately I haven’t gotten around to making any of the updates I’ve wanted to on this project, and it has been years since I’ve worked on it.)
To run it: download the github repository from https://github.com/drocta/TILDE-ATH
then, (probably from the command line, though running it in other ways may also work) navigate into the folder where you put all those files, use python 2 in order to run interp_2.py . [1] Then, it will allow you to type something in. It would be good if it gave some sort of prompt saying that it is accepting input, but it currently does not. What you have to type in is the file name of the drocta ~ath program that you want to run.
for example, you might type:
python interp_2.py looptest.~ATH
in order to run the program looptest.~ATH , and then you would see the output:that alternates between “APPLE” and “ORANGE” a number of times (like, 5 times I think).
If it isn’t working for you, let me know and I can try and help you troubleshoot what’s going on.
If you are asking, not “how do I run the programs in this language” but “how do I write programs in this language”, uh, read through the rest of this blog I guess. It isn’t complete, but the point of this blog was meant to be a tutorial for how the language works. If you have any particular questions about how to do a particular thing in the language, then ask that. But I don’t currently have time to re-do the whole project of this blog and put a tutorial for the language as a whole in one response to an ask.
P.S. I am currently in grad school for math (I made this language while in high school). I haven’t been doing all that much programming lately unfortunately.
([1] What’s that? “interp_2.py” is a weird name for the main file? Indeed it is. Originally I had “interp.py” and then before I started using git I made a new version which I called interp_2.py, and then, for basically no good reason, I kept that name for the file. If I go back to this at all, I suspect that I will change that to just “interp.py” or maybe “main.py” or something. idk.)
@ karkathateseveryonesposts
Anon in that ask was me, not rping as you say but what I meant from computer-exploding code is I was unsure if ~ATH was supposed to crash once running a code like Sollux's. Also, there couldn't be a syntax error as the program crashes if I press enter with no code on it yet.
Ah! My apologies for my misunderstanding, I interpreted the reference to computer exploding scripts combined with your handle to [ justification for why I misinterpreted snipped for brevity].
You don’t type the script in when you run the program. You need to first save the script as a seperate file, and then when you run the interpreter, type in the filename.
The last bit of the interpreter says like
filename=raw_input() filelink=open(filename,'r') script=filelink.read(-1) result_obj=evalScript(script,NULL_obj) raw_input("press enter to close")
I probably should have made it more clearly ask for a file name instead of just having a prompt with no explanation.
(also, wow, this reminds me that this code was written in python 2.7 and not python 3. Maybe I should update it to use python 3? There’s also many other things about it that ought to be improved but it isn’t high on my priorities..)
My ~ATH keeps crashing whenever I run a non-computer exploding code, or if I press enter. Why is this?
Based on the username which recently followed this blog at the same time as I received this ask (which I won't say what it was because you asked this on anon, and haven't received permission), I'd guess that you may be running a different version of ~ATH than the one I document here :P
Unfortunately, I don't have a specification for the version you have.
If you have such a specification, or the executable for it, I'd be happy to take a look if you could send it to me, haha.
If on the off chance you are using the version I document here, then presumably you have a syntax error or something in your code?
I made a parser for ~ATH in addition to the interpreter. I might make the interpreter use the parser at some point in the future, or I might not. If I made the interpreter use the parser, the code for the interpreter would probably be a little cleaner, and possibly a little faster.
The parser is available from my github.
To use it, call tokenize on the text, and then read_all_from on the result of tokenize.
The output will be a list of lists
https://github.com/drocta/TILDE-ATH-Parser
(haven't updated lately because of other unrelated projects, and also other reasons that aren't necessary to describe)
News and tutorials on drocta ~ATH by drocta. interpreter here A brief summary of how to write code in the language (but also see the table of contents)
38 posts