Quo vadis, GPC?
rugxulo at gmail.com
Wed Jul 28 06:20:41 CEST 2010
On 7/26/10, Frank Heckenbach <ih8mj at fjf.gnu.de> wrote:
> since GPC development has mostly stalled, I've thought about if and
> how its development could be continued.
Well, I'm a Pascal noob, barely learned a subset of it (off and on)
since January. I'm also honestly not a very good programmer nor very
experienced in *nix or C/C++. And to make matters worse, I like DOS (a
lot)! ;-) But anyways, here's some random comments from me:
GPC's strengths are its multi-platform, cross-compilable base with
good optimizations and support for lots of dialects (and good docs and
examples, IMHO). The downside is few developers (so?), relying on
semi-outdated GCC versions (so?), somewhat hard to bootstrap on
non-*nix (so?), big runtimes and thus big .EXEs (so?), lacking the
latest / greatest from Delphi (so?), and lacking a public CVS/SVN repo
for current sources (not needed by me, but ...).
Written in C shouldn't be a downside in theory, but I'll admit that C
leaves some things to be desired and can be arcane (although I don't
know if I think C++ is much better, syntax-wise). Heck, if you think
C++ is better, just rewrite GPC in C++ ! It's interesting that Go and
SPECS (C++) both took some syntax from Pascal due to inherent
Also, as we all know, FPC ain't too shabby either. It's main strengths
are little GNU utils reliance (and none on Win32, uses own built-in
assembler + linker), no libc needed, compiles itself. But it also has
very few developers and still lacks support for ISOs 7185 or 10206.
They follow Delphi very heavily (generics, ANSI string, Unicode,
exceptions). To be honest, it's a little surprising that BP-style
Pascal is so common and preferred. Esp. for ISO 10206, GPC seems like
the only reasonable choice. (Seems Prospero/Win32 is freeware now, but
it didn't install the "license" correctly for me on XP, yuk.)
I've made a small list (meaning to eventually post to comp.lang.misc)
of various language translators. I too was wondering recently if it's
the "way of the future." It would indeed solve a lot of problems (in
theory). Of course, be aware that there will always be backend bugs,
secondary platforms that don't get bugfixes or have old tools, etc. So
even if you intend to support "standard" C++, there will always be
problems, even on the "big three" OSes (which I hope you plan to
extend beyond). In other words, some things which "should" work
everywhere don't. Don't expect any miracles. (Try visiting OS News
sometime to broaden your horizon.) ;-)
Long story short, there's already a BP-ish Pascal to C++ (but also
some C sometimes) converter! :-)
(ignore weird comments about "shareware", it's free with sources)
Apparently there are also TPTC (old, very buggy), PTC (written in
itself, very old, GPC dislikes it), and of course P2C (which GNU has
on their retired/deprecated project list; of course, 1.20 is from
1991, and unfinished 1.21 from 1993, which I *think* had some partial
Object Pascal support -> C++.)
It might be easier to just initially target one dialect (10206? isn't
that your favorite?) as a testbed. Of course that's sorely overlooked.
You'd get more support from users by targeting BP or Delphi, but those
are weird in their own ways (various levels).
P.S. My really horrible Befunge-93 interpreter compiles via P2C with
BCC/Dev86, which is the only way I can easily get it to build for ELKS
(which is dead and I've never heavily used, heh, go figure). So things
like that are useful! Still, I may just finally (also) convert it to C
manually (already tried and failed twice) for smaller size.
Translators are also good when one compiler backend has limitations
(e.g. Minix 2.0.2 16-bit, pc's "integer" is 16-bit and I don't see any
way of making it 32-bit except by using cc and "long").
More information about the Gpc