Re:Ask HN: What languages used to write computer languages?
by silentbicycle on Saturday January 09, 2010 @09:27PM
(#1042494)
It'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.
Re:Ask HN: What languages used to write computer languages?
by scott_s on Sunday January 10, 2010 @08:15AM
(#1043026)
You 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
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.
Some languages have generated another language as the intermediate; RatFor to Fortran 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).