3 ms·
But why would you when LLVM is there and will generate much better, much easier and very probably have fewer bugs than any custom one.
by pertymcpert 3y ago
But why would you when LLVM is there and will generate much better, much easier and very probably have fewer bugs than any custom one.
- jimsimmons 3y agoBecause I want to be self hosted
- compiler-guy 3y agoSelf-hosting llvm isn't all that hard. But you might possibly have found that one weird corner case where it doesn't make sense to depend on a mighty, highly-sophisticated, industrial-strength, extremely well tested and supported, nicely mature, compiler tooling framework. But that's a pretty big exception to most language implementers who get all of that and more for super-cheap compared to implementing it themselves.
- vidarh 3y agoSelf hosted typically includes building the compiler in the language it compiles. E.g. my Ruby compiler is self hosted except for needing an assembler and linker (and I might get rid of that need too) and a minimal C library. If you're writing a C++ compiler, self-hosting LLVM might not be a massive additional complexity. For any other language it's not an option if self hosting is one of your goals.
- agalunar 3y agoEducation – learning to do something yourself – is a worthy end unto itself. Learning things is fun. Knowing how something works front-to-back feels good. If you're making something that's meant to be load-bearing, something professional that will be used in production, then yeah, just use LLVM. But otherwise I think it's important people feel free to decide the goals and constraints of their hobbies and to pursue their preferences when it comes to their personal projects.
- pertymcpert 3y agoThe original comment was about languages not something that was purely a hobby.
- agalunar 3y agoI wasn't replying to the original comment. I was replying under the branch of the comment tree where jimsimmons wrote > Let’s say I’m targeting x86 or PTX or some standard subo instruction set. I can do vanilla codegen but it is slow af and > Because I want to be self hosted which struck me as something a hobbyist would say but someone working on a production-grade language and compiler would not.