3 ms·
This looks great, I’ll definitely use it. Is there any similar project like this where LLVM IR is used? I’ll start building a language just for fun during wee
by DethNinja 6y ago
This looks great, I’ll definitely use it.
Is there any similar project like this where LLVM IR is used? I’ll start building a language just for fun during weekends and I plan to use LLVM but it is rather hard to understand clang on limited time, so a smaller scale project would be awesome.
- poidos 6y agoI used LLVM for a small compiler; not for C, but for a Java-like language: https://github.com/LucianoLaratelli/dj2ll-public https://github.com/LucianoLaratelli/dj2ll-public All the API calls are contained within codegen.cpp.
- ndesaulniers 6y agoThe Kaleidoscope LLVM tutorial!
- mhh__ 6y agoI would look at the LLVM tutorials, and maybe the insides of your favourite languages compiler (other than clang) When it comes to both parsing and emitting IR, keep it simple (stupid!) - the difficult bit (on a day to day basis) with the compiler is almost always the language semantics, the backend is more theory-dense but to just implement a language you can use LLVM as a black-box. If you minimise mutable state and utilise lowering (you can implement foreach by lowering the AST to a for loop, for example) your compiler will be much easier to debug.