Re: Need idea for a compiler project

Donald Strong <donald.s.strong@gmail.com>
Fri, 18 May 2012 00:35:20 -0700 (PDT)

          From comp.compilers

Related articles
Need idea for a compiler project raphaelernani@gmail.com (Raphael Ernani Rodrigues) (2012-04-19)
Re: Need idea for a compiler project donald.s.strong@gmail.com (Donald Strong) (2012-05-18)
| List of all articles for this month |
From: Donald Strong <donald.s.strong@gmail.com>
Newsgroups: comp.compilers
Date: Fri, 18 May 2012 00:35:20 -0700 (PDT)
Organization: Compilers Central
References: 12-04-038
Keywords: courses, code
Posted-Date: 18 May 2012 12:48:24 EDT

Hi Rapheal,


I am developing a code generator called ClassMaker.
https://sourceforge.net/apps/trac/classmaker/wiki


The objective of Classmaker is to make code generation easy and as a
consequence it is not particularly optimised.
I don't really care as I intend to use ClassMaker for generating
classes from within applications or as a back end for domain specific
languages, so efficiency is not my primary goal.


The JVM doesn't directly support boolean types in expressions. You
have to push ones and zeros onto the stack and then perform tests
based on these values. The result is lots of bloated bytecode around
branches and shortcut logic expressions.


One can use a peephole optimiser to optimise out all of this redundant
code, as described in this BCEL paper.


http://bcel.sourceforge.net/downloads/paper.pdf
Section 2.8


I use a class called ClassFileWriter, which is pulled directly out of
Mozilla Rhino Javascript compiler, to generate the bytecode.
An optimiser that works on the methods (arrays of byte) that this
produces might meet your requirements and may help me as well.


This is not a high priority for me, but I saw your post and thought I
would throw it out there.


Regards Donald.



Post a followup to this message

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