Re: How to translate a language that runs on JVM?

napi@cs.indiana.edu (Mohd Hanafiah Abdullah)
12 Jan 2005 22:55:19 -0500

          From comp.compilers

Related articles
How to translate a language that runs on JVM? jrefactors@hotmail.com (2005-01-03)
Re: How to translate a language that runs on JVM? sgganesh@gmail.com (2005-01-09)
Re: How to translate a language that runs on JVM? holycall@paran.com (Seokwoo Choi) (2005-01-09)
Re: How to translate a language that runs on JVM? vbdis@aol.com (2005-01-09)
Re: How to translate a language that runs on JVM? news8573@paulcager.com (Paul Cager) (2005-01-09)
Re: How to translate a language that runs on JVM? napi@cs.indiana.edu (2005-01-12)
Re: How to translate a language that runs on JVM? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2005-01-12)
Re: How to translate a language that runs on JVM? pohjalai@cc.helsinki.fi (A Pietu Pohjalainen) (2005-01-12)
Re: How to translate a language that runs on JVM? caseyh@istar.ca (Casey Hawthorne) (2005-01-14)
| List of all articles for this month |

From: napi@cs.indiana.edu (Mohd Hanafiah Abdullah)
Newsgroups: comp.compilers
Date: 12 Jan 2005 22:55:19 -0500
Organization: Computer Science, Indiana University
References: 05-01-012
Keywords: Java

<jrefactors@hotmail.com> wrote:
>If we want to write a language translator that translates one language
>to another language (Java Source Code or Byte Code) that runs on JVM,
>which of the following approaches is better?
>
>1) Non-Java Source Code -> Language Translator -> Java Source Code
>2) Non-Java Source Code -> Language Translator -> Java Byte Code
>please advise. thanks!!


I would go with (2), in fact I did. It's a C to Java byte code
translation. I did consider C to Java source (1) but worried about
the crypticness of the resulting Java source.


The compatibility issues between Java byte code and other languages
such as C are real and challenging, but it's solvable. The
performance is also a concern, but so far by utilizing the techniques
in register allocation (graph coloring) I've been able to maximize the
use of JVM's local variables which I treat as if they are registers,
instead of having to access the large array of int I created to mimic
memory. This reduces code size somewhat and also makes it faster than
accessing the large array of int everytime a C variable is referenced.


Napi
--
http://www.axiomsol.com
http://www.cs.indiana.edu/hyplan/napi.html


Post a followup to this message

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