3 ms·
A compiler is a translator. It translates programs from one programming language to another. You always want to compile to the easiest target language that sol
by ant6n 11y ago
A compiler is a translator. It translates programs from one programming language to another.
You always want to compile to the easiest target language that solves the problem well and allows you to do the optimizations you want to do. By compiling to C++, they can focus on static typing and closures etc., but don't have to worry about generating machine code, and register allocation and whatnot.
Back in school, I worked on a project to compile Matlab. We picked Fortran as the target, because it was very similar in terms of operating on matrices. But it's typed, and had a few very fast compilers available.
- marssaxman 11y agoOf course. I've written a compiler myself which used C++ as its output language. It just amused me that the authors made a point of specifying one characteristic of the program which is generally assumed as the default, while making no mention of another, far less common characteristic which effectively defines the scope of their project.