[comp.compilers] Modula-2 grammar sought

csgw@alpha.cs.ru.ac.za (George Wells) (02/25/91)

I've been given the task of porting fairly large quantities of 
Modula-2 code to C.  If I am unsuccessful in finding a PD
translator for this purpose I am probably going to have to
work one up myself.

My question is: Is there a YACC/Bison grammar available anywhere
for Modula-2, that could be used as the basis for this project?

Thanks in advance,
George.
[If someone has such a grammar, I'd be happy to add it to the collection.
-John]
-- 
Send compilers articles to compilers@iecc.cambridge.ma.us or
{ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.

grosch@gmdka.uucp (Josef Grosch) (02/28/91)

George Wells (csgw@alpha.cs.ru.ac.za) writes:
> I've been given the task of porting fairly large quantities of 
> Modula-2 code to C.  If I am unsuccessful in finding a PD
> translator for this purpose I am probably going to have to
> work one up myself.

We have a Modula-to-C translator that may do this job within minutes.
Though it is not PD, it is very cheap. A short description follows.

Josef Grosch



MTC(1)           GMD-Forschungsstelle-Karlsruhe            MTC(1)


NAME
     mtc - Modula-2 to C translator

DESCRIPTION
     Mtc translates Modula-2 programs in readable and therefore
     maintainable K&R C code without major restrictions (even
     nested procedures and modules).  The translator is largely
     generated using the GMD compiler construction toolbox. It
     contains semantic analysis as far as needed for the task.
     Semantic analysis is rather complete and comprises scope
     handling, name analysis, and type determination. Context
     conditions are not checked, as it is assumed that only
     correct programs are processed. Mtc translates Modula-2 as
     defined in "N. Wirth: Programming in Modula-2, Third
     Corrected Edition, Springer-Verlag, 1985".

RESTRICTIONS
     Coroutines are not implemented yet.
     Comments are lost.

IMPLEMENTATION-LANGUAGES
     Modula-2 or C

TARGET-PLATFORMS
     SUN 3 oder SUN 4 / SunOS
     DEC Station / ULTRIX
     VAX / ULTRIX oder BSD UNIX 4.2
     PCS Cadmus / MUNIX
     others

DISTRIBUTION
     Medium: DC 300 A data cartridge or TK 50 in tar format
     source program in Modula-2 as well as in C
     binary executable for SUN 3

CONTACT
     J. Grosch
     GMD Forschungsstelle an der Universitaet Karlsruhe
     Vincenz-Priesznitz-Str. 1
     D-7500 Karlsruhe 1
     Tel: +721-6622-26
     E-Mail: grosch@gmdka.uucp

PRICE
     Source licence: 500 DM or 250 US $
-- 
Send compilers articles to compilers@iecc.cambridge.ma.us or
{ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.

csgw@alpha.cs.ru.ac.za (George Wells) (03/04/91)

Thanks to all who replied following my request for Modula-2 to
C translators, or Modula-2 grammars.

> I've been given the task of porting fairly large quantities of 
> Modula-2 code to C.  If I am unsuccessful in finding a PD
> translator for this purpose I am probably going to have to
> work one up myself.

The following reply (from Carl Witty <cwitty@cs.Stanford.EDU>) is
typical:

  Dave Gillespie's p2c Pascal to C translator has a Modula-2 mode.  It
  doesn't quite handle all of Modula-2's features, but it may be enough
  for you.  It's available by anonymous ftp to csvax.cs.caltech.edu; the
  author is daveg@csvax.cs.caltech.edu.

Several people also suggested looking at the Modula-3 compiler available
on the net.  There were no Modula-2 grammars forthcoming.

Others who replied were:
  wilker@gauss.math.purdue.edu (Clarence Wilkerson)
  m2xenix!sequent.com!pasqnt!jfk (Jim Kerrigan)
  raymond@math.berkeley.edu (Raymond Chen)
  Pat.Terry@f4.n494.z5.fidonet.org
  Chris Siebenmann <cks@hawkwind.utcs.toronto.edu>
  Piet van Oostrum <piet@cs.ruu.nl>

Troy Zerr <zerr@math.wisc.edu> wrote:

  Writing a reliable translator from Modula-2 to C is not particularly
  easy.  Doing the translation by hand would almost certainly be quicker
  than writing a robust translator, and would probably be quicker than
  writing an unreliable translator and then manually fixing up the
  translated code.

  However, if you are interested, someone wrote a master's thesis
  on a Modula-2 to C translator.  Hang on a sec ...

  The thesis was written by Matthias Martin at Karlsruhe, Germany.
  The thesis is titled 
  "Entwurf und Implementierung eines Ubersetzers von Modula-2 nach C"
  and as the title would suggest, the thesis is in German.  


Frode Odegard (frode@DCI2FD.DAS.NET) wrote:

  There's a German company with a Modula-2 --> C translator.   Call
  Real Time Associates - (81) 656 7333.  They're GOOD guys and won't sell
  anything untested.  Ask for Dave Fox, tell him Frode Odegard sent ya.

  What a *sad* task, sir. :-)

  ....- Frode Odegard, Veda Technologies
  PS: reply to frode@toaster.sfsu.edu

Again thanks to all who replied.

George Wells.
-- 
Send compilers articles to compilers@iecc.cambridge.ma.us or
{ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.

acmfiu@serss0.fiu.edu (ACMFIU) (03/09/91)

George Wells (csgw@alpha.cs.ru.ac.za) writes:
> I've been given the task of porting fairly large quantities of 
> Modula-2 code to C.

There is a pascal to C translator knows as p2c which can be had from
csvax.caltech.edu. It "knows" about Modula2 code but to what extent I
don't know. You can mail the author, Dave Gillespie at daveg@csvax.caltech.edu
for more info. What's more, it's PD.

albert
-- 
Send compilers articles to compilers@iecc.cambridge.ma.us or
{ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.