comp.lang.ada
 help / color / mirror / Atom feed
* Re: Pascal to Ada Tools?
       [not found] <4ne1km$j8d@news.pacifier.com>
  1996-05-16  0:00 ` Pascal to Ada Tools? Dale Stanbrough
@ 1996-05-16  0:00 ` Wiljan Derks
  1 sibling, 0 replies; 3+ messages in thread
From: Wiljan Derks @ 1996-05-16  0:00 UTC (permalink / raw)



Steve Doiel wrote:
> 
> I am looking for a cheap (free) Pascal to Ada translator.  Nearly a year ago I
> posted a message to this effect and the most positive response I received was
> from a company that would do a 100% guaranteed translation for $1 per SLOC.
> 
> I have come to the conclusion that the only way I will get such a translator
> is to write it myself.  This also gives me the opportunity learn more about
> Ada, since I am new to the language.
> ...
> Questions:
> Does anyone know of better tools for performing this task?
> Is there somewhere that I might find pieces of the translator that are
> already done?
> I have also a lot of code in pascal (actually EPASCAL from DEC).
I came to the same conclusion as you: write my own translator.
So that is what I did. It converts EPASCAL reasonable wel to ada. The more
standard pascal it is the better it will be translated.
I use a general compiler like program:
  - using aflex and ayacc to generate a parser that build a tree
  - going through the tree rearanging things
  - then output the stuff in ada
My program can read many pascal modules at once. This allows the converter
to use the in and export information of the modules and thus generate the right
ada code.

If your interested then let me know. If you want the program to behave differently
then you must modify it yourself.

For those interested in VAXELN (thats where EPASCAL comes from): I also wrote
a port of the VAXELN kernel primitives using ada based on NT.

Wiljan




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Pascal to Ada Tools?
       [not found] <4ne1km$j8d@news.pacifier.com>
@ 1996-05-16  0:00 ` Dale Stanbrough
  1996-05-16  0:00 ` Wiljan Derks
  1 sibling, 0 replies; 3+ messages in thread
From: Dale Stanbrough @ 1996-05-16  0:00 UTC (permalink / raw)



Steve Doiel, steved@pacifier.com writes:
"I have come to the conclusion that the only way I will get such a translator
 is to write it myself.  This also gives me the opportunity learn more about
 Ada, since I am new to the language."
 


From last year on comp.lang.ada...
--------------------------------------------------------------------------

From: mcneills@landcare.cri.nz (Stephen McNeill)
Newsgroups: comp.lang.ada
Subject: Re: Pascal -> Ada Translator
Date: Fri, 16 Jun 1995 10:23:56 LOCAL
Organization: Landcare Research New Zealand Ltd

In article <3ro5dp$r6t@news.pacifier.com> steved@pop3.pacifier.com writes:

>We have a bunch of code written in DEC's VaxELN Pascal...
>Ada looks like a straightfoward translation.  Anyone know where
>to find the tool?

It's not all that straightforward really, but it appears that the 
tedious part of translation of Pascal to Ada can be fairly well
automated.  Given that so many different dialects of Pascal exist,
it's hard to believe that there would be a single tool that would
deal with the problem comprehensively.  Specifically, dealing with
inter-module references (calling externally, global variables),
and dealing with the I/O system give the most headaches.

VAX Pascal (I assume VAXeln Pascal is the same or similar ?) is one
of the worst dialects to deal with, since it is relatively complex.
Standard Pascal is a lot easier, although much more restricted.

Pure 100% translation may be a bit of a holy Grail, but 95% translation
may be quite acceptable, and was in my case.  95% translation cut down 
my manual effort considerably, and left me to concentrate on cleaning
up the code, removing Pascal limitations and adding Ada strength.

While I can't point to you a publically available tool, here are some
pointers that may help:

1) A chapter in a book that I found useful:

       Rodgers,M.W "Pascal to Ada Conversion", pp 49-61,
       in "Scientific Ada" Ford,B and J.Kok and M.W.Rogers (Eds),
       Cambridge University Press, 1986, ISBN 0-521-33258-3.

2) A document reviewing some aspects of Non-Ada to Ada conversion:

       Kaman Sciences Corp. "A Review of Non-Ada to Ada Conversion"
       Prepared for Rome Laboratory, August 5 1993. [This is available
       as http://www.utica.kaman.com/techs/ada/NonAda2Ada.ToC.html]

3) A GNU public domain translator, originally written for GNAT, was
posted by Rolf Ebert in 1994 to this newsgroup.  I don't have an
email for him, since an earlier email address is no longer valid.  This
is a useful starting point for a translator, or it was for me.

Hope this helps.

Stephen

----------------------




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Pascal to Ada Tools?
@ 1996-05-16  0:00 John Howard
  0 siblings, 0 replies; 3+ messages in thread
From: John Howard @ 1996-05-16  0:00 UTC (permalink / raw)



On 16 May 1996, Steve Doiel wrote:
[..deletions..]
> I am looking for a cheap (free) Pascal to Ada translator.
>
> I have come to the conclusion that the only way I will get such a 
> translator is to write it myself.  This also gives me the opportunity 
> learn more about Ada, since I am new to the language.
>
> Questions:
> Does anyone know of better tools for performing this task?
> Is there somewhere that I might find pieces of the translator that are
> already done?
>
> Any suggestions are welcome.  Any indication as to whether or not I am
> following a resonable path is welcome as well.

There appears to be a useful toolset available called Gramact.  It might 
require changes to work with GNAT.  I have not used it yet.  I found it 
yesterday from the Bindings link on WebAda.  The entire project is about 
450 kb Zip compressed.  Listed below are the programming languages 
currently supported and some URL's to English documentation.

LGL Component Library (Swiss Federal Institute of Technology at Lausanne)
http://lglwww.epfl.ch/Components/

Gramact Components: support for parsing and lexical analysis.
http://lglwww.epfl.ch/Components/Gramact/Abstract.html
http://lglwww.epfl.ch/Components/Gramact/directory.html
ftp://lglftp.epfl.ch/pub/Ada/Components/lgl_Gramact.tar.gz

The file to build the text formatter for Ada programs:
ftp://lglftp.epfl.ch/pub/Ada/Components/adastruct.tar.gz

ABSTRACT
   Under the Gramact project, a toolset of lexical and syntactic analyser
   generators has been developed. The generators are table-driven, i.e. a
   parameter dynamically determines what language grammar to use for
   source code analysis.

   Lexical and syntactic grammars of taget languages are defined in
   GRAMOL, an EBNF-like notation.

   Lexical_Analyser_G is a generic package for lexical analysis. It may
   be used alone.

   Syntax_Analyser_G is a generic package for syntax analysis, including
   access to the lexical tokens of Lexical_Analyser_G. To allow execution
   of user-defined actions, grammar decorations control where the parser
   must suspend analysis.

   The paper entitled "GRAMACT: Presentation et mode d'emploi" only
   available in French, provides an overview, a rough user's guide, and
   the most accurate information on how to use the Gramact programs. The
   grammar editor mentioned in the paper about the Syntax Analyser,
   Gredi, has been replaced with a simpler solution; two programs now
   separately decorate a grammar with actions (DECOGRA) and extract
   actions from a (decorated) grammar (EXTRACT).
   http://lglwww.epfl.ch/Components/Gramact/Gramact.html

GRAMOL: A grammar Description Language for Lexical and Syntactic Parsers
http://lglwww.epfl.ch/Components/Gramact/Gramol.english.html

Lexical_Analyser_G: A Multi-Language Lexical Analysis Package
http://lglwww.epfl.ch/Components/Gramact/Lexical.english.html

Syntax_Analyser_G: A Multi-Language Syntax Analysis Package
http://lglwww.epfl.ch/Components/Gramact/Syntax.english.html

Some language syntax definitions in Gramol:
pascal.gra
http://lglwww.epfl.ch/cgi-bin/expand/pascal.gra:Gramact/Grammars

ada95.gra
http://lglwww.epfl.ch/cgi-bin/expand/ada95.gra:Gramact/Grammars

c_lex.gra
http://lglwww.epfl.ch/cgi-bin/expand/c_lex.gra:Gramact/Grammars

ada83.gra
http://lglwww.epfl.ch/cgi-bin/expand/ada83.gra:Gramact/Grammars

modula-2.gra
http://lglwww.epfl.ch/cgi-bin/expand/modula-2.gra:Gramact/Grammars

ecl.gra
http://lglwww.epfl.ch/cgi-bin/expand/ecl.gra:Gramact/Grammars

example.gra
http://lglwww.epfl.ch/cgi-bin/expand/example.gra:Gramact/Grammars

gramol.gra
http://lglwww.epfl.ch/cgi-bin/expand/gramol.gra:Gramact/Grammars

WebAda
http://sw-eng.falls-church.va.us/AdaIC/compilers/webada/

------------------------------------------------------------------------
-- John Howard <jhoward@sky.net>                       -- Team Christ --
--   New American Standard Bible  (Psalm 22:30-31)                    --
--     Posterity will serve Him;                                      --
--     It will be told of the Lord to the coming generation.          --
--     They will come and will declare His righteousness              --
--     To a people who will be born, that He has performed it.        --
------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-05-16  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4ne1km$j8d@news.pacifier.com>
1996-05-16  0:00 ` Pascal to Ada Tools? Dale Stanbrough
1996-05-16  0:00 ` Wiljan Derks
1996-05-16  0:00 John Howard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox