Pascal Viandier wrote:
I spent 3 years converting our legacy Pascal applications from SUN Pascal to GNU Pascal under Sparc Solaris. Many big programs, in fact, with a mixture of Pascal, C, C++, ESQL, 4GL, name it... The conversion was an adventure, mostly because the SUN Pascal compiler had digested bugs in our code for years without detecting them. By using GPC, we found approximately 350 bugs at compile time and more than 450 runtime errors that were never seen before. The result is we produced the most reliable release ever of our programs.
So, maybe what is under the hood of GPC is not as clean as it could (As you mention in your article), but GPC is the best Pascal compiler I ever used, And your support for it has been five stars quality.
Thanks. Indeed, the "internal" and "external" quality in this regard is almost unrelated, so I'm not surprised by your observations (thought the numbers are quite impressive :-).
Compile-time error checking is almost entirely a front-end issue and relatively straightforward, without the backend getting in the way, apart from its data structures, i.e. if you want to check e.g. "this type must be an integer type", you have to know how to express this in TREE_NODEs (which is among the basic things one has to learn when working on GCC), but otherwise you just do your checks and emit your errors.
For runtime errors, of course, you need to emit code, i.e. through the backend, but usually this code is relatively easy (e.g. for range-checking, 1 or 2 comparisons and a call to an error routine -- which is implemented in the RTS in Pascal, not produced by the compiler). The more difficult part is figuring out where to implement which checks, which again is almost entirely a frontend issue.
So it's no surprise that GPC has become quite good at catching errors (as well as adding simple features which has become easier than 10 years ago). But at the same time, it has run into a (possible) dead-end with backend integration, and implementing larger features (e.g., new object model, exceptions, templates) in the current GPC is more difficult than it would be with a cleanly written compiler.
Frank