
Flower Compiler (Bootstrapped Compiler)
Hey all!
For the past few months I've been working on a language called Flower. It was originally written in C (files can be found under /vendor/) but is now fully bootstrapped (with some caveats). The goal is to eventually move toward a fully self-hosted toolchain and custom backend, but for now it transcompiles to C.
Some current language features:
- structs
- pointers (
@T) - arrays
- function definitions/calls
- manual memory management (
new/prune) - operator precedence parsing
- struct literals / array literals
- casts
- dereferencing / address-of
- control flow (
if,while,for, etc.)
Example:
struct Vec2 {
x: float,
y: float
}
float length(v: Vec2):
return v.x * v.x + v.y * v.y
end
I thought I knew a decent amount of C and programming before hand, especially considering this isn't my first time making a language in C, but I've noticed how far my skills have come especially regarding just being able to problem solve and properly organize my project structure.
Recently I added parser error recovery in v1.1.0, and after a lot of trial and error I think I've finalized my parser to a recursive-descent style approach.
Let me know any criticism, opinions, or comments you have! I'd love to get some input :)