4 ms·
Sorry, no, I meant that the compiler for language X is written in C. Some languages have generated another language as the intermediate; RatFor to Fortran http
by gvb 17y ago
Sorry, no, I meant that the compiler for language X is written in C.
Some languages have generated another language as the intermediate; RatFor to Fortran http://en.wikipedia.org/wiki/Ratfor http://en.wikipedia.org/wiki/Ratfor and C++ to C for the first generation of C++ are the two I remember.
In my experience, this is a horrible thing to do because it is extremely difficult to find and fix the root cause for errors that turn up when compiling the intermediate language (e.g. Fortran or C).
- silentbicycle 17y agoIt's easier to compile to a (restricted subset of) C and let other compilers worry about code generation than to try to do the whole stack yourself. C, in particular, works passably as a "portable assembler". If you already compile to bytecode, for example, you could include the VM as a library and transliterate the bytecode to C.
- scott_s 17y agoYou may want to know that "cross compile" means that you compile for one architecture while on a different one. Like compiling for PowerPC while on an x86. http://en.wikipedia.org/wiki/Cross_compiler http://en.wikipedia.org/wiki/Cross_compiler Since that was clearly not what you meant, I was confused as to what you did mean. I wouldn't call what you intended "cross compile" - there's no "cross" to me. It's common to implement a higher-level language in a lower-level language.