Re: Source to source Translation ? (Bob Sheff)
2 Feb 1997 21:16:16 -0500

          From comp.compilers

Related articles
Source to source Translation ? (Waverly Edwards) (1997-01-30)
Re: Source to source Translation ? (1997-02-02)
Re: Source to source Translation ? (1997-02-02)
| List of all articles for this month |

From: (Bob Sheff)
Newsgroups: comp.compilers
Date: 2 Feb 1997 21:16:16 -0500
Organization: Compilers Central
References: 97-01-243
Keywords: translator, C, Pascal

Waverly Edwards <> wrote:

> Could any point me to some source code for translating C to Pascal.

Who would want to go to Pascal from C?
Most of our (Applied Conversion Technologies, Inc) customers want to
go to C from (Pascal | PL/M | Assembler | COBOL | FORTRAN | ...)

>I have just a few requirements.

>1. It be commented or narrated pretty well

We duplicate the current comments in proper CONTEXT.
Some customers (esp Assembly) wanted SOURCE SPECIFIC comments removed!

>2. It not be someones PH.D thesis model


> (If it is, its likely to be way over my head)

The real question is does it work.

>I have done *some* required reading, by Reiss (I think it was Reiss,
>maybe it was Weill) - Springer Verlag lecture notes on Source to
>Source translation using ABSIM. While the concept was not over my
>head, the notation and language was pretty hard reading. I also have
>Ronald Maks - Creating compilers and interpreters. I'm currenly
>investigating how all the different parsers and lexical analyzers work.

>I'd like to know if anyone knows of other books on source to source

No, just practical experience.

>I think my biggest problem is going to be pointer arithmetic and the
>translation of operator precedence. I dont know if I these obstacles
>can be overcome.

In translating C to Ada, we have specifiic rules which, as a person
reviewing the code would do, will make the leap into the Ada idiom
whenever possible. Most of the time it works, the rest of the time,
the compiler will catch the errors. Personally, I like to teach the
translator to make that leap whenever possible.

>My overall goal is not only to translate C to Pascal but to:

>1. Understand the process in minute detail (First an foremost)

Good Luck!

>2. Create an interpreter (post translation)


>3. Create a source to source level debugger, to track the correctness of the

We have Assertion tests which run in the source and target language
and produce the same output. What can a "debugger" do other than
compare actual output with expected output?

>4. Be equipped with good stuff like cross referencers.

Good stuff allows understanding of the SOURCE system so that the
TARGET system may be easily measured against these expectations.

>A compiler is not my ultimate goal but it would be icing on the cake.
>I would be extremely satisfied with an interpreter. Thats probably
>sacrilegous for a compiler group but sometimes you just have to go
>against the grain.

This subject is much more complicated than a compiler, because the
TARGET is much more complicated than a chip (especailly if you want
the comments preserved within context). An acurate interpreter is the
best you can hope for without a lot of experience(MEGABYTES of code).

>Hey, I know I want a lot with very little background but I dont give
>up easily.

Good Luck, again.

>Thanks for any help I can get,

Bob Sheff (

Post a followup to this message

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