6 ms·
I really like QBE but I hope they will make it a true library because I don't want to launch a subprocess to compile a program.
by lucrbvi 4mo ago
I really like QBE but I hope they will make it a true library because I don't want to launch a subprocess to compile a program.
- heavensteeth 4mo agoThis is exactly my gripe unfortunately, it feels like needless fragility. IIRC the author has said they believe it wouldn't be too difficult to patch QBE to work as a library, but from what I've seen the code is somewhat terse and eccentric.
- fuhsnn 4mo agoThere is a library conversion fork: https://github.com/sgraham/sqbe https://github.com/sgraham/sqbe. IMO when the intended usage is AOT with an external assembler, which is another subprocess, text-based IO is actually the more natural approach.
- mamcx 4mo agoTangentially: Is there a Rust alternative similar to this?
- sparky4pro 4mo agoThere are at least 2 Go libraries written in Go, based on QBE. One is used by this project: https://github.com/xplshn/gbc https://github.com/xplshn/gbc
- duped 4mo agoWhy not? Processes are cheaper than you might think. GCC invokes several as an example.
- rurban 4mo agoBecause this concept only works for offline compilers, but not for dynamic languages. It's about 100x slower. I'm just converting the call to an external assembler in my compiler rcc to assemble the bytes directly. No need for strings and external files. The cost of the external call is outrageous.