Oops, I Wrote a C++ Compiler
41–42 of 42 posts
Re: Oops, I Wrote a C++ Compiler
#42Earlier quoted context omitted.
It is very well explained? GCC and Clang would be nightmares to integrate into an app that runs on many platforms including iOS, and even once you did, you'd still need to implement an interpreter, because you're not allowed to JIT on the app store. Compiling a toolchain for a desktop platform is easy. Cross compiling a toolchain is moderately easy. But embedding a toolchain into an iOS app, where you have to get it…
For Clang/LLVM, it wouldn’t be that hard. It’s one source tree to build (Clang is in a separate repo from LLVM core, but you check it out into a specific subdirectory and they build together), all C++, no external dependencies, and the result is a set of static libraries you can easily link into an iOS app. As for interpreting — there are a few options. The simplest approach would be to use LLVM‘s built-in IR interpr…