Yes, not sure what you mean by this but its indeed what I’m getting at, our compilers aren’t built enough in unix fashion to my liking. gcc handles preprocessing, compilation and linking. but I wouldn’t know how to run a second preprocessor after the first one in gcc
Comment on Does this compiler exist?
nodoze313@lemmynsfw.com 11 months ago
spykyvenator@programming.dev 11 months ago
noli@programming.dev 11 months ago
LLVM 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.
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.
spykyvenator@programming.dev 11 months ago
LLVM really looks like something that I need to look into
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.
nodoze313@lemmynsfw.com 11 months ago
Does running lint prior not resolve the issue? Isn’t this the entire goal of make, cmake, autotools, etc? Why do you need to run it after? So you can re-process the macros after they are in line? Should just validate the macros before running gcc.
spykyvenator@programming.dev 11 months ago
It is somewhat like running multiple linters and prettifiers but these are hefty tools, the build tool should provide an interface that lets you attach different programs for every little step from code to machine lang
monotremata@kbin.social 11 months ago
It really sounds like you're describing Make. Is there something you need it to do that Make can't handle?
Zeth0s@lemmy.world 11 months ago
This was my immediate reaction as well.
For those who like living a messy life, there’s always Visual Studio (the original beast, not VSCode)