|Source to source Translation ? Waverly@DigitSW.com (Waverly Edwards) (1997-01-30)|
|Re: Source to source Translation ? firstname.lastname@example.org (1997-02-02)|
|Re: Source to source Translation ? email@example.com (1997-02-02)|
|From:||Waverly Edwards <Waverly@DigitSW.com>|
|Date:||30 Jan 1997 22:16:57 -0500|
Could any point me to some source code for translating C to Pascal.
I have just a few requirements.
1. It be commented or narrated pretty well
2. It not be someones PH.D thesis model
(If it is, its likely to be way over my head)
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
I'd like to know if anyone knows of other books on source to source
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.
My overall goal is not only to translate C to Pascal but to:
1. Understand the process in minute detail (First an foremost)
2. Create an interpreter (post translation)
3. Create a source to source level debugger, to track the correctness of the
4. Be equipped with good stuff like cross referencers.
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.
Hey, I know I want a lot with very little background but I dont give up easily.
Thanks for any help I can get,
[Operator precedence is easy -- build an expression tree, walk over it to
emit Pascal, and stick in parentheses when you find a lower precedence
expression inside a higher precedence one. Pointers are harder, since there's
a lot of wild 'n' crazy things you can do in C that you can't do in Pascal
without gross implementation-dependent hackery. Take a look at p2c, which
goes the other way and does a decent job of putting out readable source code.
The hard part isn't generating valid output code, it's generating code that
doesn't look like decompiled assembler. -John]
Return to the
Search the comp.compilers archives again.