Re: Writing a C compiler in Java/Jython

torbenm@diku.dk (Torben AEgidius Mogensen)
8 Jun 2001 23:18:08 -0400

          From comp.compilers

Related articles
Writing a C compiler in Java/Jython adsharma@sharmas.dhs.org (2001-06-07)
Re: Writing a C compiler in Java/Jython torbenm@diku.dk (2001-06-08)
Re: Writing a C compiler in Java/Jython korek@icm.edu.pl (2001-06-10)
Re: Writing a C compiler in Java/Jython walter@nospamm-digitalmars.com (walter) (2001-06-10)
Re: Writing a C compiler in Java/Jython mcc@watson.ibm.com (2001-06-14)
| List of all articles for this month |

From: torbenm@diku.dk (Torben AEgidius Mogensen)
Newsgroups: comp.compilers
Date: 8 Jun 2001 23:18:08 -0400
Organization: Department of Computer Science, U of Copenhagen
References: 01-06-019
Keywords: Java
Posted-Date: 08 Jun 2001 23:18:08 EDT

adsharma@sharmas.dhs.org (Arun Sharma) writes:


>I wanted some opinions from people who might have attempted this in
>the past: Writing a C compiler in Java. Also, would using a scripting
>language like python (specifically the jython implementation of the
>language) have any advantages in writing optimization algorithms ?


I strongly recommend writing a compiler in a language that supports
automatic storage reclamation (garbage collection or similar). If I
was to choose a specific language, I would go for Standard ML, using
the ckit package from Bell-labs
(http://cm.bell-labs.com/cm/cs/what/smlnj/doc/ckit/).


>While I'm waiting to get a copy of Steven Muchnick's book, are there
>any other good resources on the net about the choice of an intermediate
>language (low, medium, high) ? Specifically, about the suitability
>of an intermediate language for a particular optimization algorithm ?


Some transformations (inlining, blocking) are most easily done in a
high-level intermediate language while others are better suited for
low-level IL's. Muchnick's book (like many others) advocate the
SSA-form, which is a fairly low-level IL using a special convention
for variable bindings. In "Modern Compiler Implementation in
ML/Java/C", Andrew Appel also describes SSA but goes on show how the
lambda calculus in CPS form can be seen as SSA extended with functions
and scopes. The description in said book is fairly sketchy, but other
reports and papers describe the idea in more detail. Appel's other
book "Compiling with Continuations" is tied closely to compiling ML
(and is also a bit dated), so I won't recommend this as the sole
source of using CPS form as an IL.


Torben Mogensen (torbenm@diku.dk)


Post a followup to this message

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