On Thu, 2026-06-18 at 14:30 -0400, Paul Koning via cctalk wrote: > > > As for translating from one language to another, that was pretty > > much > > standard practice for a long time. GNAT Ada produced C. P2C > > converted > > Pascal to C. F2C the same for Fortran. Early precursors of GNU > > COBOL > > did the same. Assembler knowledge is not necessarily needed to > > write > > a compiler if you have another language to function as the > > intermediate > > stage of the compiler. > > True, but that approach has significant drawbacks and from where I > sit it appears more like a technique that was used for a while as a > shortcut to implementing a language. All the examples you gave are > now obsolete, at least in the GCC system, replaced by full front ends > that tie into the code generation machinery. A reason why this > matters is debug info; having C debug info for your Fortran program, > let alone COBOL or Pascal, is painful. Another reason is semantic > mismatches. C doesn't like nested function definitions (though GCC > sort of allows them as an extension) while other languages (Algol for > sure, and Pascal also I think) consider them perfectly good things to > do.
The NAG Fortran compiler generates C. It does a reasonable job of telling gdb where things are. At least I've successfully used gdb with it. The generated code is pretty good, although not as good as a native compiler such as ifx, because there are things that Fortran "knows" about your code that it simply cannot explain in C. nagfor is the pinnacle of outstanding compile time and run time diagnostics. But it was written by, and is entirely maintained by, one guy: Malcolm Cohen. For a time he had a colleague who developed and maintained the runtime library. Of course, all the math stuff comes from the NAG library. He has mentioned writing a native code generator instead of C, but he's not done it yet. And by using C he provides the compiler for Linux, Windoze, and MacOS. He frequently laments C compilers' imaginative interpretations of the C standard, especially what gcc believes "ISO standard C" actually means. He's also the project editor for the Fortran standard. I wish I had had his energy when I was his age, let alone at my age now.
