[comp.compilers] Translating Pascal to C

chrism@mtuxo.att.com (XMRJ4-C.MCCABE) (05/27/89)

	Does anybody know where I can locate any good books on
how to create language translation utility programs?  In particular,
I'm going to create a Pascal-to-C utility program, and am having
some trouble locating books in this area.  Any advice would be
greatly appreciated. Thank you in advance.

[I've never seen anything in depth on this sort of thing. My experience is
that source-to-source translators are if anything more difficult than regular
compilers, both because there are things that are easy to say in Pascal that
are hard to say in C, e.g. nested scopes, and because in a translator you want
the output to be readable by humans as well as by computers.  -John]
[From chrism@mtuxo.att.com (XMRJ4-C.MCCABE)]
--
Send compilers articles to compilers@ima.isc.com or, perhaps, Levine@YALE.EDU
Plausible paths are { decvax | harvard | yale | bbn}!ima
Please send responses to the originator of the message -- I cannot forward
mail accidentally sent back to compilers.  Meta-mail to ima!compilers-request

schwartz@shire.cs.psu.edu (Scott Schwartz) (06/02/89)

In article <4727@mtuxo.att.com>, chrism@mtuxo (XMRJ4-C.MCCABE) writes:
>I'm going to create a Pascal-to-C utility program, and am having
>some trouble locating books in this area. 

Such a thing was posted to usenet (comp.sources.unix I think) about
two years ago, with a set of patches sometime later.  It was called
"ptc".

>[I've never seen anything in depth on this sort of thing. My experience is
>that source-to-source translators are if anything more difficult than regular
>compilers, both because there are things that are easy to say in Pascal that
>are hard to say in C, e.g. nested scopes, and because in a translator you want
>the output to be readable by humans as well as by computers.  -John]

Ptc does pretty well on most of that. Its major failing is that it
tries to generate clever C code (using macros) for pascal I/O
statements, and gets some things wrong. :-(
-- 
Scott Schwartz		<schwartz@shire.cs.psu.edu>
--
Send compilers articles to compilers@ima.isc.com or, perhaps, Levine@YALE.EDU
Plausible paths are { decvax | harvard | yale | bbn}!ima
Please send responses to the originator of the message -- I cannot forward
mail accidentally sent back to compilers.  Meta-mail to ima!compilers-request