Re: Writing a C compiler in Java/Jython

mcc@watson.ibm.com (Mark C. Chu-Carroll)
14 Jun 2001 00:24:32 -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: mcc@watson.ibm.com (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

adsharma@sharmas.dhs.org (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
algorithms.


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


                -Mark
--
    "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 (mcc@watson.ibm.com)
IBM T.J. Watson Research Center


Post a followup to this message

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