简体   繁体   中英

How to target LLVM from a compiler written in F#?

I'm part way through writing a toy language in F#. I want to target LLVM, but it looks like I'll have to do some work to make that happen.

It looks like I might be able to do some interop with the IRBuilder libraries, or I might be able to roll my own IR emitter. As far as I've searched, I couldn't find any solution that anyone else has made.

How might I do this?

I know several people who use F# + LLVM regularly, and I've seen a bunch of questions about it here on SO before: Questions tagged F# and LLVM

Anyway, take a look at the LLVM bindings for F# on Github -- that should be a good starting point.

LLVMSharp seems to be a viable solution. They have a C# tutorial to build a language on top of LLVM that should be easy to convert to F#.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM