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

Oliver Bandel <oliver@first.in-berlin.de>
14 Apr 2006 12:45:10 -0400

          From comp.compilers

Related articles
[11 earlier articles]
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)
Re: Converting Pascal to C++, C# or VB DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-04-10)
Re: Converting Pascal to C++, C# or VB gneuner2@comcast.net (George Neuner) (2006-04-10)
Re: Converting Pascal to C++, C# or VB englere.geo@yahoo.com (Eric) (2006-04-12)
Re: Converting Pascal to C++, C# or VB hebisch@math.uni.wroc.pl (Waldek Hebisch) (2006-04-12)
Re: Converting Pascal to C++, C# or VB oliver@first.in-berlin.de (Oliver Bandel) (2006-04-14)
| List of all articles for this month |

From: Oliver Bandel <oliver@first.in-berlin.de>
Newsgroups: comp.compilers
Date: 14 Apr 2006 12:45:10 -0400
Organization: Individual Network Berlin e.V.
References: 06-04-017
Keywords: Pascal, translator
Posted-Date: 14 Apr 2006 12:45:09 EDT

Steve wrote:
> I have some legacy machine control code written in ISO std Pascal that I
> would like to convert to one of the languages supported by our current
> development environment : MS Visual Studio .NET 2003. So that means C++, C
> sharp or VB.




ooops. :(


Then you might use F# ?


It's an (incomplete) OCaml port for M$.


      http://research.microsoft.com/fsharp/fsharp.aspx


Some things might look a littlebid pascal-like,
so porting might be easier than to the ugly languages
from the C-family.


> It's a big chunk of code - about 500k lines in 200 files. I currently have a
> translator that converts it to Delphi. This enables us to run it on a PC,
> but it will not fit easily with our newer code which is in C++ and C#. ...


There should be similarities in the constants-thing I think.


> So the question is which language to use? I know C++ a little, but the other
> two are new to me.


C++ is ugly.


If the OCaml-port to M$ was not too bad then you should use this.




> So far the main obstacle I can see with C++ is the nested routines of
> Pascal.


What do you mean with nested routines? Example?


Do you mean (mutual) recursion or what?




  > I don't know of any way to do this in C++.


you might explain what you mean...
...maybe you can write it in C++ in a different way.


But I would not say use C++ as you has seen I
would use ifferent languages.




  > Initial investigation
> suggests that the struct in C# might be a suitable alternative. It has to
> allow access to constants, types and variables declared in an outer scope.


In Ocaml you can create types like this one:


type my_type = A of int | B of char | C of string


I think F# should do it similar.


And then you have pattern matching and that stuff, which
makes programming really a fun! :)




>
> We also have a few instances of Pascal procedural parameters. Can these be
> emulated?


example?
I once did some Pascal programming but it's a while ago and
I'm not as experienced with it like in C or Ocaml.




example-code?




>
> Fortunately no-one ever used conformant arrays. :)


unknwon term "conformant array".


Explanation for an not-so experenced Pascal-programmer?


Ciao,
        Oliver


Post a followup to this message

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