Can I use Crystal's LLVM module to create a new language?

I’m just getting into creating programming languages, and I like Crystal’s simplicity. Is Crystal’s LLVM module suitable for creating a compiler front-end that generates LLVM IR?

1 Like

Yes. Crystal itself uses it, as well as a couple other languages written in Crystal.

2 Likes

I’ve been wanting to experiment with MLIR - it never occurred to me that I might be able to leverage those experiments from inside Crystal. :dizzy:

MLIR is different, though official C bindings exist and Crystal can bind to them with ease

1 Like
1 Like

ah - interesting, thanks for that link! From the high-level docs I’d read before, MLIR was pitched as having an ability to “lower” dialects down into LLVM IR. But looking at this link, I see they’ve mostly implemented it as a C based API from what I’d assume as a passing glance to be based on clang. I’ll give the C API a look. Crystal’s C support has been incredibly good to me thus far on both win32 and linux. I just love it.