News for hackers. Stuff that matters.
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].

[0] https://news.ycombinator.com/item?id=25540637

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.

https://llvm.org/docs/tutorial/OCamlLangImpl1.html

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!