Re: Converting Pascal to C++, C# or VB

"Eric" <englere.geo@yahoo.com>
8 Apr 2006 17:05:48 -0400

          From comp.compilers

Related articles
Converting Pascal to C++, C# or VB steve@rh12.co.uk (Steve) (2006-04-03)
Re: Converting Pascal to C++, C# or VB marcov@stack.nl (Marco van de Voort) (2006-04-08)
Re: Converting Pascal to C++, C# or VB torbenm@app-4.diku.dk (2006-04-08)
Re: Converting Pascal to C++, C# or VB john@elmcrest.demon.co.uk (John O'Harrow) (2006-04-08)
Re: Converting Pascal to C++, C# or VB DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-04-08)
Re: Converting Pascal to C++, C# or VB englere.geo@yahoo.com (Eric) (2006-04-08)
Re: Converting Pascal to C++, C# or VB gneuner2@comcast.net (George Neuner) (2006-04-08)
Re: Converting Pascal to C++, C# or VB martin@gkc.org.uk (Martin Ward) (2006-04-08)
Re: Converting Pascal to C++, C# or VB neelk@cs.cmu.edu (Neelakantan Krishnaswami) (2006-04-08)
Re: Converting Pascal to C++, C# or VB thompgc@gmail.com (thompgc@gmail.com) (2006-04-08)
Re: Converting Pascal to C++, C# or VB marcov@stack.nl (Marco van de Voort) (2006-04-09)
Re: Converting Pascal to C++, C# or VB marcov@stack.nl (Marco van de Voort) (2006-04-09)
[6 later articles]
| List of all articles for this month |

From: "Eric" <englere.geo@yahoo.com>
Newsgroups: comp.compilers
Date: 8 Apr 2006 17:05:48 -0400
Organization: http://groups.google.com
References: 06-04-017
Keywords: Pascal, translator
Posted-Date: 08 Apr 2006 17:05:48 EDT

How do you want to handle maintenance? Do you want to do all
maintenance on the original Pascal code, and re-convert as needed, or
do you want all maintenance to be done on the new language?


Converting legacy Pascal code to an OOP language is going to leave you
with a very poor object model, non-optimum in every way. It may "work",
but that code can't be maintained directly.


Regardling procedural parameters, the .NET CLR supports delegates,
which are strongly typed pointers to functions. I always thought Pascal
was strongly typed until I started working with .NET - they've taken it
to the next level. You can't cast a delegate to make it point to an
incompatible function, which is definitely possible in Delphi. Anytime
you cast in .NET it has to be a cast to a compatible type, or you'll
get a runtime exception.


I *STRONGLY* recommend the book, "Compiling for the .NET Common
Language Runtime" by John Gough. A lot of people overlooked this book
because they didn't understand why it's so good. John ported a Pascal
compiler to the CLR and this book is about what he learned along the
way (by the way, this Pascal compiler is high quality and open source,
so you don't really need to convert your code in the first place).


John covers the details of the CLR as a target platform of a compiler,
and much of the book is not in any way specific to Pascal. He covers
the various ways to target the CLR by generating ilasm code, or by
emitting the code directly. John is brilliant and I read everything I
find with his name on it.


Another book that gets overlooked is "Compiling with C# and Java" by
Pat Terry. This is also great for explaining how to target the CLR from
a compiler. If you live in the US you have to order this from amazon in
the UK, since it's not available in the US.


Eric


Post a followup to this message

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