Is Inkwell complete enough?

Currently I am writing front-end for a small statically typed language having standard constructs like variable declaration, assignments, if-elif-else, for-while loop, function, closure, struct, lambda type, interface, generics etc. I am moving towards wiring up the backend which is really confusing. I want to use LLVM IR but not sure is there a good support for LLVM API bindings in rust.
Wanted to know is llvm-sys crate or Inkwell crates are complete enough to implement above constructs ?
Or is there any other alternative better than this?

I would recommend Inkwell, it's been around for quite a while (I think I first used it 2 or 3 years ago?) and the crate covers all the LLVM API that you need for writing a language backend. Reading through Publish inkwell to · Issue #154 · TheDan64/inkwell · GitHub, it seems like they haven't published to because the way they manage LLVM versioning is incompatible with the way cargo expects versions and feature flags to be used, not because the crate is unstable.

Directly using the llvm-sys crate will require you to write a lot of unsafe code which you will almost certainly mess up unless you've used the LLVM C API from other languages. I wouldn't recommend it unless you've got some obscure requirements.


thanks @Michael-F-Bryan for the suggestion. I will dig deeper into the usage of the crate.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.