euclidianAce

Trying my best

  • they/them

can post now >:3

I like math and compilers

posts from @euclidianAce tagged #compiler development

also:

Hey! Long time no compiler-chosting. A short time after writing my first short post about named arguments, I got super frustrated with the C programming language and decided to port my compiler to Zig. The short of it is that I had many memory errors (be it use after free/move (which moves were the worst since lots of things happened to be stored in an arena), use of uninitialized memory) etc. and I got sick of debugging them. Now Zig isn't exactly memory safe either (it does have safety features though), but I'm not proficient enough in Rust to want to rewrite my compiler in it.

Anywho, I am on the tail end of re-implementing arrays, and if you're familiar with Pascal or Ada, you know these aren't your ordinary, run-of-the-mill arrays. These are advanced arrays.



Here's the main result of what I've been working on! (Apart from some use-after-frees and allocator bugs :P)

Function calls with named arguments!
Main ::= function do
   Standard_Out : File_Descriptor := 1

   Write (
      File    => Standard_Out,
      Message => "Hello world!\n",
   )
end

File_Descriptor ::= range 0 .. 2^64 - 1
Byte            ::= mod 2^8
Index           ::= range 1 .. 2^64 - 1
Byte_String     ::= array [Index range <>] of Byte

Write ::= function (
   File    : File_Descriptor,
   Message : access Byte_String,
) do
   @​inline "rax" := 1
   @​inline "rdi" := File
   @​inline "rsi" := Message ['first]'access
   @​inline "rdx" := Message'length
   @​inline "Syscall"
end

This is usually one of my favorite features of any programming language that has it so I definitely planned to have this in for a while.

This brings the parsing of aggregates and function arguments much closer together, thus simplifying my parser a bit.

(aggregate syntax)
Foo : Some_Aggregate_Type := {
   Bar => "Baz"
}


Hi! I figured I'd make an intro post since I want to make an attempt to actually post things to social media rather than just lurking.

I'm euclidianAce

  • they/them: If I had to describe my gender, I would simply say "no, thank you" and walk away.
  • autistic with my special interests being
    • programming (specifically compilers and other lower level stuff)
    • math (category theory and type theory are neat :D)

I think I'd like to use this to blog about random things I end up developing the same way that I use social media to look at cool things other people have made. So here's some stuff I've been doing:

I've done a bit of work on Teal, (tl;dr it's like typescript but for Lua) and quite a bit more on its build system, Cyan.

My hobby project for the past year or so is a compiler for a low(ish1) level language of my own design heavily inspired by the Ada programming language, but with less of the cruft. If I were to make an handwavey analogy, I want this language to be what Rust is to C++ and what Zig is to C, but for Ada.