4 ms·
I've briefly looked at LLVM and how to interface with it but back then I didn't find much else than some C++ Builder API. I'd hope for some textual format that
by mjaniczek 5y ago
I've briefly looked at LLVM and how to interface with it but back then I didn't find much else than some C++ Builder API. I'd hope for some textual format that I could give to LLVM as an input. I assume it exists and that I've just been googling wrong :) Would definitely appreciate some pointers in that regard.
Other than that my best bet for native binaries is most likely compiling to C or GraalVM (which already exists as an experimental backend in elm-in-elm via Truffle!)
- adjav 5y agoThe textual representation is known as the LLVM IR (the reference is at https://llvm.org/docs/LangRef.html https://llvm.org/docs/LangRef.html). My understanding (as purely an amateur enthusiast) is that generally using a higher-level builder, like the ones for C++ or OCaml, is recommended, but that it's entirely possible to generate the IR directly.
- MobiusHorizons 5y agoAs the other comment says, LLVM has a text based IR. But you may also want to look into QBE which is simpler and lighter weight than LLVM but has a similar text interface so you could start with that to get up and running, and then add support for llvm later.
- lioeters 5y agoTo save anyone else a search: QBE: Compiler Backend - https://c9x.me/compile/ https://c9x.me/compile/ QBE vs LLVM - https://c9x.me/compile/doc/llvm.html https://c9x.me/compile/doc/llvm.html
- rishav_sharan 5y agoCompiling down to C is a great idea as well. Nim does that