Re: Source to source Translation ? (Derek M Jones)
2 Feb 1997 21:23:08 -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: (Derek M Jones)
Newsgroups: comp.compilers
Date: 2 Feb 1997 21:23:08 -0500
Organization: Knowledge Software Ltd
References: 97-01-243
Keywords: C, Pascal, translator, comment "Waverly Edwards" writes:

> 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)

Ok. So it does not have to be free. Check out our web pages for

> 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.

Actually these are 'easy' problems to solve.

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

Our goals changed over time (customer driven). Check out for some history.

> [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]

Our Moderator knew about p2c but not about CtoP :-(


Derek M Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd email:
Applications Standards Conformance Testing
[Harumph, nobody tells me nothin'. -John]

Post a followup to this message

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