Re: Writing a C compiler in Java/Jython (Mark C. Chu-Carroll)
14 Jun 2001 00:24:32 -0400

          From comp.compilers

Related articles
Writing a C compiler in Java/Jython (2001-06-07)
Re: Writing a C compiler in Java/Jython (2001-06-08)
Re: Writing a C compiler in Java/Jython (2001-06-10)
Re: Writing a C compiler in Java/Jython (walter) (2001-06-10)
Re: Writing a C compiler in Java/Jython (2001-06-14)
| List of all articles for this month |

From: (Mark C. Chu-Carroll)
Newsgroups: comp.compilers
Date: 14 Jun 2001 00:24:32 -0400
Organization: IBM Global Services North -- Burlington, Vermont, USA
References: 01-06-019
Keywords: C, Java,
Posted-Date: 14 Jun 2001 00:24:32 EDT (Arun Sharma) writes:

> All,
> 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 ?

While the simple expressiveness of python can be a huge help in
implementing experimental algorithms, the Jython implementation
should be avoided for any serious work.

I'm working on a software configuration management system, where I'm
writing the bulk of the system in Java. I spent some time
experimenting with alternative delta computation and storage
algorithms, which I implemented in Python. The way that Python handles
data structures, particularly hashes and tuples, made the code
dramatically simpler to read and write.

However, when I tried running the code using Jython, I ended up
running out of stack space, even with huge stacks, on not very large
examples. When I spent time probing, the problem turned out to be that
the Jython implementation effectively made multiple nested calls for
each direct python call, and that was blowing up the stack.

I've done some further experiments, and concluded that Jython is
wonderful for adding simple scripting to your application, but that it
cannot reasonably be used for large applications or complex

(Note that none of this applies to C-Python. C-Python worked on my
test code extremely well, without the dramatic stack explosion of

    "There's nothing I like better than the sound of a banjo, unless of
      course it's the sound of a chicken caught in a vacuum cleaner. "
Mark Craig Chu-Carroll (
IBM T.J. Watson Research Center

Post a followup to this message

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