PtoC Delphi Pascal to C++

"Jim Hargis" <>
6 Mar 2000 23:50:09 -0500

          From comp.compilers

Related articles
PtoC Delphi Pascal to C++ (Jim Hargis) (2000-03-06)
| List of all articles for this month |

From: "Jim Hargis" <>
Newsgroups: comp.lang.c++,comp.compilers
Date: 6 Mar 2000 23:50:09 -0500
Organization: Compilers Central
Keywords: Pascal, C

I am migrating an existing Delphi application to run on Windows CE. I
am working around the VCL dependencies, the GDI support, and the GUI
redesign. The mechanical translation of Delphi syntax is giving me
problems. I have tried PtoC to translate the "non-object" subset of
the code, with the following results.

The core question: is there a valid Lex/Yacc or co-co or PCCTS or ...
definition that accepts Delphi and emits C++ code? Or any part of this
problem? Does anyone care? Obviously no one at Borland is interested.

Sorry for the multiple post, but this is a multiple platorm question.
Please respond to my email address below: That way
we can keep the responses down to the active newsgroups.

Here is a list of the junk that caused me trouble....

The big problem with the PtoC program is that , if it cannot parse
Pascal file correctly, it will produce NO OUTPUT. So, I had to spend
a good deal of time getting source into a form that PtoC would be able
to parse. Then hand-translate the untranslated comments.

The Delphi comments had to be fixed. (only {} are acceptable, not // )

Tell PtoC to see (* *) type comments (-nested or -turbo).

PtoC setting (-turbo) is the best way to interpret Delphi (I tried several

XOR operation caused problems in translating and had to be commented out.

Certain array declarations needed to be commented out.

The CONST portion of function arguments had to be commented out.

The OUT portion of function aurguments had to be commented out.

The OVERLOAD declaration had to be commented out.

There were several other little obstacles, however we got through several
thousand lines of code, and are now looking at improving the process. Yes,
I am looking for commercial products and services.


Jim Hargis
GIS Engineering

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.