Re: info on source to source translation

"Terence Parr" <>
Thu, 18 Nov 1993 18:18:40 GMT

          From comp.compilers

Related articles
WANTED - info. on cross-progrmming-language translation (1993-11-16)
Re: info on source to source translation (Terence Parr) (1993-11-18)
| List of all articles for this month |

Newsgroups: comp.compilers
From: "Terence Parr" <>
Keywords: translator
Organization: Compilers Central
References: 93-11-107
Date: Thu, 18 Nov 1993 18:18:40 GMT

Gary Funck ( writes:

> A few questions:
> 1) Can you recommend any published work/research on the subject of
> automated source code conversion?

Gee, I'd like to recommend my latest tool to be released soon: SORCERER
(source-to-source tr5anslator generator). It performs deterministic tree
walks which the user specifies using ANTLRish EBNF notation. SORCERER
descriptions can be smoothly integrated with ANTLR descriptions so that
you can do this kind of stuff:

e : INT ("&&"^ INT)* ; // match things like '3&&4&&5'

#section SORCERER

xe : #( "&&" xe )
      | INT

where '#( "&&" xe )' matches a tree with a logical "and" operator at the
root and the rule 'xe' as a child (which in turn can be another subtree or
an 'INT'). Note that, in the grammar spec, a '^' character was used to
tell ANTLR that it should build a tree out of the input for that rule with
all INTs as leaves (by default) and with "&&" as the subtree root. This
example is complete except for the main(), the usual tokens to ignore
white space, and any attribute definitions etc...

SORCERER can be used without ANTLR and, in fact, with any application that
has trees which must be traversed. This tool differs from code-generator
generators in that no "costs" or "weighs" are automatically associated
with applying a production and, hence, optimal traversals are not the
goal; i.e., the tree grammar must be deterministic.

If you would like some papers on SORCERER they're available for FTP in Or send "help" to the e-mail
server at Failing that, send email to
(I can do email PS or USNail paper).

> 2) Do you know of any public domain toolsets that offer a general
> framework for translation? Ideally what we'd like to see is something
> that accepts an input grammar description (yacc syntax preferred), and a
> method for describing parse-tree transformations, and methods for walking
> the final tree and generating source code.

ANTLR and DLG (components of PCCTS codeveloped with W. Cohen, H. Dietz,
and R. Quong at Purdue) plus the new SORCERER tool would provide a very
nice framework for you. We build LL(k) top-down parsers so we have the
essential notation of YACC (except we allow EBNF), but use a different
parsing strategy; e.g., we allow semantic predicates and syntactic
predicates (arbitrary lookahead). I have papers on these tools as well if
you're interested.

> 3) Do you have any success/failure stories on using automated source
> translation, that you'd like to share?

My colleagues and I (Matt O'Keefe and Aaron Sawdey at U of MN) have been
working on a major translation project for a few years, called Fortran-P,
that converts serial fortran 77 (with restrictions and assumptions) to
parallel Connection Machine Fortran; this translator using *multiple*
SORCERER-generated passes. If you are interested, let me know and I'll
send you PS of the paper.


Terence Parr
U of MN
Army High Performance Computing Research Center

Post a followup to this message

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