Re:A Complete Guide to LLVM for Programming Language Creators
by tylersmith on Friday December 25, 2020 @10:05PM
(#25541032)
What do you mean by C++ adapter? All the c++ in this post is building the LL files in memory, which can them be persisted to disk or wherever.
Re:A Complete Guide to LLVM for Programming Language Creators
by CGamesPlay on Friday December 25, 2020 @10:14PM
(#25541073)
Ah I didn’t understand that aspect. So we write the parser in ocaml, then serialize it to protobuf, then consume that from C++ so we can call LLVM’s API to write the expected file format? That still seems needlessly complicated. Is the file format simply too arcane?especially given [0].
Re:A Complete Guide to LLVM for Programming Language Creators
by tylersmith on Friday December 25, 2020 @11:48PM
(#25541463)
I see, in this case the author's compiler was written in c++, but you can use ocaml instead to build the IR. There is even a version of their great tutorial series using ocaml you can check out. All the concepts he outlines are the same, just convert the c++ bits to the corresponding ocaml version of the IRBuilder. Then you can go from your language to llvm IR all in ocaml.
Re:A Complete Guide to LLVM for Programming Language Creators
by CGamesPlay on Saturday December 26, 2020 @12:38AM
(#25541671)
Ah, I understand now. Thanks for helping!
If I wanted to target LLVM, why wouldn’t I emit ll or bc files?