LLVM really looks like something that I need to look into
Comment on Does this compiler exist?
noli@programming.dev 11 months agoLLVM is designed in a very modular way and the LLVM IR allows you to specify e.g. if memory management should be manual/garbage collected.
You could make a frontend (design a language) for LLVM that exposes those options through some compiler directives.
In general I’d heavily recommend looking into LLVM’s documentation.
spykyvenator@programming.dev 11 months ago
jeffhykin@lemm.ee 11 months ago
LLVM is the engine everything compiles to. The problem is there’s no car, it’s just the engine lol.
And other than Rust (which uses LLVM) the existing cars are not very configurable, at least not at the level of configuration you’re wanting.
jeffhykin@lemm.ee 11 months ago
Wow I knew some about LLVM IR but I had no idea it had high level options like garbage collection.
noli@programming.dev 11 months ago
Oh yeah, it’s actually pretty extensive and expressive. If you’re interested in this sort of stuff it’s worth checking out the IR language reference a bit. Apparently you can even specify the specific garbage collection strategy on a per-function basis if you want to. They do however specify the following: “Note that LLVM itself does not contain a garbage collector, this functionality is restricted to generating machine code which can interoperate with a collector provided externally” (source: llvm.org/docs/LangRef.html#garbage-collector-stra… )
If you’re interested in this stuff it’s definitely fun to work through a part of that language reference document. It’s pretty approachable. After going through the first few chapters I had some fun writing some IR manually for some toy programs.