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

"Paul Cager" <news8573@paulcager.com>
9 Jan 2005 20:55:25 -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: "Paul Cager" <news8573@paulcager.com>
Newsgroups: comp.compilers
Date: 9 Jan 2005 20:55:25 -0500
Organization: http://groups.google.com
References: 05-01-012
Keywords: Java, translator
Posted-Date: 09 Jan 2005 20:55:25 EST

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 say it is generally better to translate to Java code and let a
Java compiler translate that to Bytecode. Although Bytecode is fairly
user-friendly, generating it still involves a lot of unrewarding
tedium. Let the Java compiler do that for you, leaving you to
concentrate on your own translator.


There are a few problems with this approach though:


* You will obviously have to install a Java compiler on your
target machines.
* Starting up the Java compiler may make the whole translation
slower (maybe Jikes would be the best bet?)
* You might not feel like you have written a "proper" compiler!


Have you considered JavaCC as a Parser generator by the way? It fits
nicely in with the "generate java code from similar source" approach.
I'm not sure if this would be useful for you or not.


Paul


Post a followup to this message

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