News for hackers. Stuff that matters.
Re:Ask HN: What languages used to write computer languages? by scott_s on Saturday January 09, 2010 @09:08PM (#1042459)
I'm confused by question 1. I assume by saying "cross compile the language in C" you mean "the compiler for language X generates C code." If so, the answer is easy: to leverage the heavily used, portable and well optimized machine-code generators that exist for C.
Re:Ask HN: What languages used to write computer languages? by gvb on Saturday January 09, 2010 @09:19PM (#1042480)
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 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).

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.