Link: https://git.ablecorp.eu/mlokis/hblang.git
Hello,
For quite some time, I had been trying to create a programming language. Initially, I focused on the frontend while outsourcing the backend to a library. However, at some point, someone needed a language that compiles to a VM ISA, and so I started writing the backend myself.
At this point, I can compile to x86_64-linux and hbvm-ableos (made up architecture on some operating system). It is very Zig-inspired, but the syntax is simpler and more uniform.
I recently rewrote the register allocator, which simplified the instruction selection a bunch. These days, I need to force myself to implement dwarf as well.
I also made a website where you can try out the language (compiler is run locally in wasm): https://depell.mlokis.tech
As of today, the compiler does optimizations like mem2reg, global value numbering, global code motion, and a bunch of peephole optimizations. It uses Sea of Nodes, which is encapsulated behind an SSE builder API. The backend does not depend on the frontend and can be used as a library. I am planning to use it to jit-compile hbvm instructions to native ones.
When it comes to the frontend, the language supports comptime evaluation and also partial comptime evaluation. It has $loop, $while, and $if as a comptime control flow. Types are values and functions support comptime $parameters, making generic data structures similar to Zig, in that you just use a function.
Syntax is very unrestrictive. Writing fn(): type return struct {} is fine, and so on, semicolons work similarly to JavaScript, but in practice, I made syntactic decisions that make the need for them rare.
When it comes to tooling, the compiler can format code and remove redundant parentheses and semicolons. No configuration, but similar to Zig, you can guide it with trailing separators.