When does it make sense to compile my own language to C code first?
If you are designing your own programming language, when do you think it makes sense to convert it to C or C++ code so that you can use existing compiler like gcc to convert to machine code?
I think it is never. All languages that did translate to C or C++ changed their ways. C++ used to get translated to C but now it is translated to machine code directly instead of using C as an intermediate language. Similarly many languages did.
If you are writing your own language, convert the code to LLVM intermediate representation (IR) or GIMPLE (gcc's intermediate representation) and leave it to llvm or gcc to convert to machine code. LLVM IR has become famous these days as it is a stable representation, GIMPLE is internal and it can change. Swift uses LLVM for example. You will get the same optimisation and performance once your language code is converted to LLVM IR and passed to llvm for processing.
Given your question I would strongly suggest you read about compilers. Its a beautiful field.
PrasannaKumar Muralidharan
Kernel developer @ Witworks
I think it is never. All languages that did translate to C or C++ changed their ways. C++ used to get translated to C but now it is translated to machine code directly instead of using C as an intermediate language. Similarly many languages did.
If you are writing your own language, convert the code to LLVM intermediate representation (IR) or GIMPLE (gcc's intermediate representation) and leave it to llvm or gcc to convert to machine code. LLVM IR has become famous these days as it is a stable representation, GIMPLE is internal and it can change. Swift uses LLVM for example. You will get the same optimisation and performance once your language code is converted to LLVM IR and passed to llvm for processing.
Given your question I would strongly suggest you read about compilers. Its a beautiful field.