Re: Building a translator. Want to know if this is feasible...

"Lex Spoon" <lex@cc.gatech.edu>
12 Nov 2002 14:14:57 -0500

          From comp.compilers

Related articles
[3 earlier articles]
Re: Building a translator. Want to know if this is feasible... vugluskr@unicorn.math.spbu.ru (Roman Shaposhnick) (2002-11-07)
Re: Building a translator. Want to know if this is feasible... gsc@zip.com.au (Sean Case) (2002-11-08)
Re: Building a translator. Want to know if this is feasible... stanley.chow@cloakware.com (Stanley Chow) (2002-11-08)
Re: Building a translator. Want to know if this is feasible... vbdis@aol.com (VBDis) (2002-11-08)
Re: Building a translator. Want to know if this is feasible... gopi@sankhya.com (Gopi Bulusu) (2002-11-08)
Re: Building a translator. Want to know if this is feasible... JeffKenton@attbi.com (Jeff Kenton) (2002-11-08)
Re: Building a translator. Want to know if this is feasible... lex@cc.gatech.edu (Lex Spoon) (2002-11-12)
Re: Building a translator. Want to know if this is feasible... enrico.santoemma@mail.com (Enrico Santoemma) (2002-11-15)
Re: Building a translator. Want to know if this is feasible... idbaxter@semdesigns.com (Ira Baxter) (2002-11-17)
Re: Building a translator. Want to know if this is feasible... kgw-news@stiscan.com (2002-11-17)
| List of all articles for this month |
From: "Lex Spoon" <lex@cc.gatech.edu>
Newsgroups: comp.compilers
Date: 12 Nov 2002 14:14:57 -0500
Organization: College of Computing, Georgia Tech
References: 02-11-013 02-11-046
Keywords: translator, practice
Posted-Date: 12 Nov 2002 14:14:56 EST

"Jeff Kenton" <JeffKenton@attbi.com> writes:


> socrates wrote:
> >
> > Hello all,
> >
> > There is a computer language that has been dead for over a decade.
> > However, there are numerous programs that have been built using this
> > dead language.
> >
> > Now my "pending task" will be to make a translator that converts this
> > dead language to an object-oriented language like java.
>
> What is this language?
>
> It's probably possible. Having the manual is a good start. Having sample
> programs is useful, especially if there are reasonable comments. (People
> used to comment their code -- it seems to be a lost art now.)
>
> You have two ways to go:
>
> * Translate to an existing language that has comparable syntax and features.


Note that doing an exact translation between high-level languages is
very hard to get exactly right. Instead, what you can hope for in any
moderate time frame is that you translate the most commonly used
features to something that behaves mostly similar to the original.
This issue is especially relevant if the language only ever had one
compiler: the existing code has definitely never been ported, and so
it is likely to rely on all kinds of not-so-undefined behavior in the
original compiler.


If you really want to maintain the old code, then these options seem
more likely to pay off with moderate amounts of effort:


    - use an emulator, as mentioned earlier


    - write an interpreter, instead of a translator


    - spit out an intermediate representation that some existing backend
        can use (in particular, lcc might be promissing)


Perhaps I misunderstand the original goal. If you are trying to get a
*maintainable* version of the program in Java (or whatever), then you
definitely don't want to bother with an exact translator. Instead, do
a rough translation and then plan to spend a lot of time tweaking each
translated program until it works correctly. Many professionals who
translate code between languages seem to end up rewriting from
"scratch" while keeping a close eye on the original code....


Also, if this latter thing is your goal, be sure to consider it very
carefully from a software engineering perspective. All new code
starts the software life cycle from scratch, and there is a lot of
value in the existing, presumably debugged, code.


-Lex


Post a followup to this message

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