4 ms·
rock, ooc's compiler, supports compilation with clang ;)
by gmaster1440 16y ago
rock, ooc's compiler, supports compilation with clang ;)
- albertzeyer 16y agoYou mean ooc -> (rock ->) C -> (clang ->) llvm? I mean ooc -> llvm. Not only that it is obviously faster and simpler, it is also better to maintain and better to optimise. And it gives more power and possibilities to the ooc compiler.
- nddrylliog 16y agoYeah, 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?
- gmaster1440 16y agorock -> C99 (compiled with clang)