Hello,
Kevan Hashemi wrote:
[...] My understanding of the GPC development is as follows. Please correct me.
The GPC development you propose is to re-write the GPC compiler in Pascal. The result will be a compiler that other Pascal programmers, like me, can fix and extend.
Correct.
The compiler will produce some kind of intermediate representation of the Pascal program. The existing IR is GCC's. Keeping up with changes in the GCC IR definition is time-consuming. You and Frank prefer C++ as the IR. Other options are the LLVM IR.
Almost correct. In the first step, the IR will be just a Pascal data structure in memory. In the second step, this will be output as C++ code (or LLVM, or whatever).
Already after the first step the compiler will be written in Pascal, so Pascal programmers, like you, can contribute to the second step.
The offer, so far, is about the first step.
Advantage of C++ is availability on all platforms, and you and Frank are familiar with C++.
Correct.
Disadvantage of C++ is compiling C++ IR will can generate its own errors, which will be mysterious to the Pascal user.
Not really. If the frontend works correctly it will catch all errors before outputting any C++ code (or LLVM, or whatever).
The debugger will operate upon the code as if it were a C++ source, which will mangle some names and types.
Yes, but this can be corrected afterwards in a later step.
In order to work on the compiler, we will have to learn C++.
No. That's exactly the purpose of step 1: enable Pascal programmers to work on the compiler.
If you want to work on the backend you need of course some knowledge about the IR, which can be C++, or LLVM, or whatever. But in any case it will be much more readable for Pascal programmers than the current GCC backend (C with hand-made "objects") or an optimizing machine-specific assembler backend.
Peter