Converters from Modula 2 to any C based Language

This is a discussion on Converters from Modula 2 to any C based Language within the modula forums in Programming Languages category; Hi, I am interested in converting some legacy code from Modula 2 to a C based language like C, C++, C# or Java. Are there any code converters?? I'd be grateful is someone could point me in the correct direction. I checked the Modula-2 FAQ at http://groups.google.com/group/comp....dafb562e736513 It addresses this topic in section 4.5. However all of the links there do not work. I also tried Canterbury Modula-2 for Java from http://www.mhccorp.com/downloads.shtml - but I could not figure out how to get that to work. Thanks a lot. O.O....

Go Back   Application Development Forum > Programming Languages > modula

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 03-21-2008, 06:22 AM
O. Olson
Guest
 
Default Converters from Modula 2 to any C based Language

Hi,

I am interested in converting some legacy code from Modula 2 to a C
based language like C, C++, C# or Java. Are there any code
converters?? I'd be grateful is someone could point me in the correct
direction.

I checked the Modula-2 FAQ at
http://groups.google.com/group/comp....dafb562e736513

It addresses this topic in section 4.5. However all of the links there
do not work.

I also tried Canterbury Modula-2 for Java from http://www.mhccorp.com/downloads.shtml
- but I could not figure out how to get that to work.


Thanks a lot.
O.O.
Reply With Quote
  #2  
Old 03-21-2008, 08:01 PM
Chris Burrows
Guest
 
Default Re: Converters from Modula 2 to any C based Language


"O. Olson" <olson_ord@yahoo.it> wrote in message
news:25581ed7-d477-4f2f-b47d-cd72be90ff2a@e23g2000prf.googlegroups.com...
> Hi,
>
> I am interested in converting some legacy code from Modula 2 to a C
> based language like C, C++, C# or Java. Are there any code
> converters?? I'd be grateful is someone could point me in the correct
> direction.
>


Maybe GNU M2? AFAIK That works as a frontend to GCC:

http://www.nongnu.org/gm2/

However, typically these sorts of convertors are merely using C as a code
generator - they weren't designed to produce human-readable / maintainable
code.
My experience with code convertors, even when used with languages that are
more closely related in capabilities than Modula-2 / C (e.g. Pascal to
Oberon) is that they are useful for converting selected procedures - not
complete applications. When you write a program in Modula-2 you usually
start off with a different design approach than you would if you were using
C.

An alternative approach would be to port the legacy code to the .NET
framework using the Gardens Point Modula-2 CLR compiler:

http://plas.fit.qut.edu.au/gpm/

and then, if you really wanted to translate it, you could use Lutz Roeder's
Reflector to decompile the resulting DLL's / EXE's to C#:

http://www.aisto.com/roeder/dotnet/

As you can call the Modula-2 code from C# code you would not have to
translate it all at once.

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/modula2


Reply With Quote
  #3  
Old 03-22-2008, 05:33 AM
O. Olson
Guest
 
Default Re: Converters from Modula 2 to any C based Language

On Mar 21, 6:01 pm, "Chris Burrows" <cfbsoftw...@hotmail.com> wrote:
>
> Maybe GNU M2? AFAIK That works as a frontend to GCC:
>
> http://www.nongnu.org/gm2/
>
> However, typically these sorts of convertors are merely using C as a code
> generator - they weren't designed to produce human-readable / maintainable
> code.
> My experience with code convertors, even when used with languages that are
> more closely related in capabilities than Modula-2 / C (e.g. Pascal to
> Oberon) is that they are useful for converting selected procedures - not
> complete applications. When you write a program in Modula-2 you usually
> start off with a different design approach than you would if you were using
> C.
>
> An alternative approach would be to port the legacy code to the .NET
> framework using the Gardens Point Modula-2 CLR compiler:
>
> http://plas.fit.qut.edu.au/gpm/
>
> and then, if you really wanted to translate it, you could use Lutz Roeder's
> Reflector to decompile the resulting DLL's / EXE's to C#:
>
> http://www.aisto.com/roeder/dotnet/
>
> As you can call the Modula-2 code from C# code you would not have to
> translate it all at once.
>
> --
> Chris Burrows
> CFB Softwarehttp://www.cfbsoftware.com/modula2


Thanks Chris for your quick response.

I forgot to mention in my original post that I use only WinXp. I have
Cygwin though - but I usually prefer not to use it if possible -
because I can never get it to work.

I looked at "GNU Modula-2 Compiler" at http://www.nongnu.org/gm2/ -
and it seems to have only installations for Debian on Linux.

I then went to Gardens Point Modula-2 in http://plas.fit.qut.edu.au/gpm/
- It does not seem to have a Windows Version of the Installation - at
least in the List of Downloads that they have. I however looked at the
Release Notes (the last PDF at the bottom) which seems to say that I
have to use an "Install Shield" etc. which sounds Windows Like - but
I don't know where to download this from.

I also noticed at the side there was an " Online GPM/CLR Compiler" at
http://plas.fit.qut.edu.au/gpm/online_compiler.aspx . However with the
sample Hello.mod I get an error saying that it could not find the
entry point and hence could not create the EXE. I also tried giving it
one of my own files - and it crashes i.e. I get a page telling me that
the application has crashed and due to security reasons it would not
tell me what the error was.

Lutz Roeder's Reflector might work for me - but first let me get this
Gardens Point Modula-2 to work, because only then it would be useful.

I would also want to know how to call Modula-2 Code from C# code - but
I don't think you need to answer that until I have got Gardens Point
Modula-2 working.

Thank you for your interest.
O.O.
Reply With Quote
  #4  
Old 03-22-2008, 11:21 AM
JP2R
Guest
 
Default Re: Converters from Modula 2 to any C based Language

Hello,

Maybe you can try XDS 'via C' modula2 compiler? But Chris said you ...
it's never that easy.

http://www.excelsior-usa.com/xds.html

JP2R
Reply With Quote
  #5  
Old 03-22-2008, 10:04 PM
Chris Burrows
Guest
 
Default Re: Converters from Modula 2 to any C based Language

"O. Olson" <olson_ord@yahoo.it> wrote in message
news:5bd7d16e-b18c-4a9e-a121-f95e27780612@s37g2000prg.googlegroups.com...
>
> I then went to Gardens Point Modula-2 in http://plas.fit.qut.edu.au/gpm/
> - It does not seem to have a Windows Version of the Installation - at
> least in the List of Downloads that they have.


The Windows .NET versions are the ones identified as gpm-clr (clr = the .NET
common language runtime).

I however looked at the
> Release Notes (the last PDF at the bottom) which seems to say that I
> have to use an "Install Shield" etc. which sounds Windows Like - but
> I don't know where to download this from.
>


You don't need InstallShield. They are just explaining that they used it to
produce the installation setup files.

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/modula2


Reply With Quote
  #6  
Old 03-23-2008, 03:56 AM
O. Olson
Guest
 
Default Re: Converters from Modula 2 to any C based Language

Dear Chris,

Thank you for the information. I could not figure out if I should use
Whidbey or Everett. I Googled this - but I got confused with what I
got i.e. I got something on Whidbey but not much on Everett so I did
not know the difference. Anyway I decided to download the CLR for
Whidbey.

I installed it. Then I tried the example that they have in the
documentation on Hello World - this did not work. I keep getting
something like: (gpx /cg hello.mod)

#gpmx: can't create tmp file
Aborting ...


I cant figure out what I am doing wrong - or where the tmp file is
attempted to be made.

Is there a mailing list or some forum for this Gardens Point
Modula-2? Or should I simply email the people on the website?

Thanks a lot.
O.O.
Reply With Quote
  #7  
Old 03-23-2008, 07:37 AM
Chris Burrows
Guest
 
Default Re: GPM Modula-2 (was: Converters from Modula 2 to any C based Language)

"O. Olson" <olson_ord@yahoo.it> wrote in message
news:a5a479ce-41cf-45ba-b652-9c82c3ccae9f@s12g2000prg.googlegroups.com...
> Dear Chris,
>
> Thank you for the information. I could not figure out if I should use
> Whidbey or Everett. I Googled this - but I got confused with what I
> got i.e. I got something on Whidbey but not much on Everett so I did
> not know the difference. Anyway I decided to download the CLR for
> Whidbey.
>


They were the pre-release codenames for Visual Studio:

Everett --> VS 2003 (.NET 1.1)
Whidbey --> VS 2005 (.NET 2.0)

> I installed it. Then I tried the example that they have in the
> documentation on Hello World - this did not work. I keep getting
> something like: (gpx /cg hello.mod)
>
> #gpmx: can't create tmp file
> Aborting ...
>
>
> I cant figure out what I am doing wrong - or where the tmp file is
> attempted to be made.
>


Maybe you haven't got the TEMP environment variable defined, or haven't got
write access to the corresponding directory? Try compiling with the verbose
option

gpx /cgV

and see if that gives any additional clues.

If you make some progress with this and decide to attempt to port your
applications, let me know as I have an experimental version of my Component
Pascal IDE
http://www.cfbsoftware.com/cpide which supports Modula-2 source code that
you are welcome to try. It's infinitely easier than trying to use a text
editor and the command-line for compiling.

> Is there a mailing list or some forum for this Gardens Point
> Modula-2? Or should I simply email the people on the website?
>


GPM support contacts are the same as for Gardens Point Component Pascal:

email: gpcp at qut.edu.au
newsgroup: http://tech.groups.yahoo.com/group/GPCP/

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/modula2


Reply With Quote
  #8  
Old 03-23-2008, 09:02 AM
O. Olson
Guest
 
Default Re: GPM Modula-2 (was: Converters from Modula 2 to any C basedLanguage)

On Mar 23, 5:37 am, "Chris Burrows" <cfbsoftw...@hotmail.com> wrote:
> Maybe you haven't got the TEMP environment variable defined, or haven't got
> write access to the corresponding directory? Try compiling with the verbose
> option
>
> gpx /cgV
>
> and see if that gives any additional clues.
>
> If you make some progress with this and decide to attempt to port your
> applications, let me know as I have an experimental version of my Component
> Pascal IDEhttp://www.cfbsoftware.com/cpidewhich supports Modula-2 source code that
> you are welcome to try. It's infinitely easier than trying to use a text
> editor and the command-line for compiling.
>
> > Is there a mailing list or some forum for this Gardens Point
> > Modula-2? Or should I simply email the people on the website?

>
> GPM support contacts are the same as for Gardens Point Component Pascal:
>
> email: gpcp at qut.edu.au
> newsgroup:http://tech.groups.yahoo.com/group/GPCP/
>
> --
> Chris Burrows
> CFB Softwarehttp://www.cfbsoftware.com/modula2



Dear Chris,

Thanks for your prompt response. I have yet to read your email
properly because I am in a hurry. Its almost morning here, and I need
to get some sleep.

With the Verbose option I get something like:


gpmx: m2 to CIL version of <no version time>
Opening "Hello.mod" as input
.... Target configuration file C:\gpm\gpmd\GPMsym\gp2d.cfg
.... Importing <InOut> from C:\gpm\gpmd\clrsyms\inout.syx
-- mod <InOut> key = 3575173240
Returning recursion
#gpmx: can't create tmp file
Aborting ...

I have TEMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp and TMP=C:
\DOCUME~1\ADMINI~1\LOCALS~1\Temp

So I think that this is Ok, because other applications can write to
it.

Thanks a lot for your interest.

O.O.

Reply With Quote
  #9  
Old 03-26-2008, 03:22 PM
Waldek Hebisch
Guest
 
Default Re: Converters from Modula 2 to any C based Language

O. Olson <olson_ord@yahoo.it> wrote:
> Hi,
>
> I am interested in converting some legacy code from Modula 2 to a C
> based language like C, C++, C# or Java. Are there any code
> converters?? I'd be grateful is someone could point me in the correct
> direction.
>

<snip>
> It addresses this topic in section 4.5. However all of the links there
> do not work.
>


In the past I have used mtc translator from the coctail suite. Trying
today web seach for mtc I only got (a lot of) dead links. But I still
have the sources on my hard drive -- if you are interesed I can put
them in a public place. I have Linux binary, but for Windows you
would have to compile it yourself (probably under Cygwin). To get
my version I had to fix a few compilation problems (the orignal
sources were intended for Sun OS) -- so do not expect clean
compilation on Windows.

There is another translator, m2c by Vladimir Makarov. I tried it
and I have found out that is has serious bug -- it generates incorrect
code for nested function calls. That is, things like:

F(G(x), H(y))

do not work.


--
Waldek Hebisch
hebisch@math.uni.wroc.pl
Reply With Quote
  #10  
Old 03-26-2008, 07:28 PM
Chris Burrows
Guest
 
Default Re: Converters from Modula 2 to any C based Language

"Waldek Hebisch" <hebisch@math.uni.wroc.pl> wrote in message
news:fse7pe$pn6$1@z-news.pwr.wroc.pl...
>
> In the past I have used mtc translator from the coctail suite. Trying
> today web seach for mtc I only got (a lot of) dead links.


Try:

ftp://ftp.uni-potsdam.de/pub/lang/modula/mtc.tar.Z

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/modula2


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:38 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.