Aglang
- 7 Devlogs
- 29 Total hours
A basic esoteric language made to be similar to Assembly. Both a compiler and an interpreter (web and local) are implemented.
A basic esoteric language made to be similar to Assembly. Both a compiler and an interpreter (web and local) are implemented.
whooo! the documentation is done!
im officially ready to ship! i finished writing the documentation and the repo readmes, and im ready to release this into the wild!
the docs are availabe in the cli’s repo, but they’re linked in the website too.
this took a few days, since i was working on another personal project, but im finally back!
the web interpreter is done!
after almost 1000 lines of svelte and 8 hours of boredom, im happy to announce that the js implementation of the aglang interpreter is completed! it is now available at https://aglang.0xf1.dev (the dns changes might take some time to fully propagate, so if it isnt loading, it probably will in a few hours…)
it is basically a 1:1 copy of the rust code, but prettier! ahem… because of the ui, not the code… and i even designed a logo for it! in it are all the valid characters in aglang.
in the meanwhile, i fixed and refactored the loop system in both the js and rust versions.
the next steps are writing the docs, preparing a good readme and then i can finally ship the project! see ya then!
and p.s. i havent optimized the website for mobile, but i imagine nobody uses stardance on a smartphone, right?
no yeah im officially going crazy
so, after a bit, the compiler is DONE!
now it spits valid x86-64 asm and even automatically compiles it to an executable with gcc!
and i even managed to make a fibonacci sequence example program! (it only computes numbers up to 144 since its the highest fibonacci number in the unsigned 8bit integer limit) but to make that, i had to spend HOURS thinking about how to do it.
the problem was that in Aglang, you have 2 registers and a stack, and for that fibonacci program i couldnt make it print random ascii characters, but instead the actual numbers in the decimal system: for that i tried making loops that converted a number into the digits that composed it, buuuuut you still need the 2 registers to keep the fibonacci numbers you have!
i even surrendered and tried asking gemini, but it would go absolutely CRAZY: it would give really long responses and contradict itself in the code… a bit of like when you ask an ai to give you the seahorse emoji.
so, the ultimate solution was to implement a “numeric value” parameter to the stdout argument.
therefore, now, if you write something like
01000001>\#;
you would get the actual 65 number instead of the character ‘A’ and all the problems would go to the compiler and assembly!
but i dont care now, cus its DONE!!!
the next steps, i think, should be making a js interpreter, so that the language can be tried online without downloading anything, so ill work on that tomorrow…
it was the comments IT HAD ALWAYS BEEN THE COMMENTS
i think im about to go crazy, cuz im trying to manually write assembly to know that the compiler should write, and trying the basic alphabet loop i couldnt get it to work, no matter what it was always printing ▒.
i tried everything, i even managed to get SATAN ITSELF to write my output (check attached image)… but finally… i tried deleting the comments i put with the original aglang line… and it worked.
i found out that the stdout token in aglang (“\”, i even have to write it twice here in the post because stardance has the same problem lmao) was making nasm think that i was trying to escape the newline after the comment, thus making the next assembly line part of the comment.
as you can see from the logged time it literally took over 2 hours of my life because of a single backslash.
so i uhh… kinda refactored everything?
i realized that to make the compiler i had 2 options:
aglang run ./main.ag
the next step is building the compiler itself, but ill leave that to tomorrow. (and i think itll just support linux elf64 x86-64 architectures, sorry arm friends!)
oh wait! i forgot to tell y’all why the name “Aglang”! nothing special actually, “Ag” just stands for “Ugly” lmao
the interpreter is done faster than i expected and after some issues i settled on the syntax. ive added comments (kinda hated working on them), changed the input structure a little bit (now the input gets directly stored on the stack).
the next step is building a compiler to x86-64 assembly, i dont think i’ll make it for other architectures. i guess it shouldnt be that hard since the language’s features are pretty similar to how assembly works (obvious foreshadowing)
this example outputs every uppercase letter in the alphabet:
01000001>''; $ move 65 (A char in ascii) to reg2 $
11010>:; $ push alphabet counter (from A to Z) into stack $
[ $ loop (ends when first value in stack is 0) $
''>\; $ output the letter $
1010>\; $ newline $
''+1; $ add 1 to the ascii value to go to the next letter $
:>'; $ move counter to reg1 $
:!; $ pop old counter $
'-1; $ remove 1 from the counter $
'>:; $ push the updated counter to the stack $
]
(the text between the $ are comments)
i’m finally building a language!
Aglang is an esoteric language (like brainf*ck) with 15 possible characters (not including the 0’s and 1’s of binary literals) where you are given two 8-bit registers and a stack: their values can be moved and deleted and arithmetic operations can be done with their respective characters.
i’m currently building an interpreter in Rust, but i hope once im done with that to start creating a compiler to x86-64 assembly.
i’ve attached a scheme made in KDE Drawy (i changed it like 8 times already) describing the language (sorry it’s in italian and my writing sucks), an aglang snippet and the parsed output in the interpreter.