3 ms·
Yeah, seems obvious right? But having a C backend (independent of LLVM) still has advantages. I will continue to maintain it, even if/when we get an LLVM backen
by nddrylliog 16y ago
Yeah, seems obvious right? But having a C backend (independent of LLVM) still has advantages. I will continue to maintain it, even if/when we get an LLVM backend.
I only wish llvm-c would suck less, then we'd get proper bindings and be able to write the llvm backend in ooc.
- albertzeyer 16y agoWhy not just write the LLVM backend in C++? The C++ interface is actually pretty clean and really easy/trivial to use.
- nddrylliog 16y agoThen we'd need to access the ooc AST from C++, which is also quite a piece of work. (I mean - it's easy to use ooc code from C in a C-like way, e.g. MyObject_myMethod(arg1, arg2), but in C++ that would be tedious/inacceptable) Besides, what's the point in having a shiny language if we have to use C++ to implement part of its compiler :(
- albertzeyer 16y agoWhoops, my bad, I didn't thought of the self-hosting. Somehow I thought that the compiler is written in C. How complicated would it be to link against C++ code from within ooc code?
- nddrylliog 16y agoNot too bad, use -linker=g++ and declare your functions extern "C" in the C++ code
- albertzeyer 16y agoIf it is easy, why not just use the LLVM C++ interface in the ooc compiler?