Euphoria/Java: A Euphoria to Java Translator
One of the Win32Lib demos, converted to Java
What is Euphoria/Java?
This is a program that translates programs written in the Euphoria programming language into Java programs. This is one of my many long-abandoned projects, but I've left it posted in case anyone is interested.
How Does This Work?
Most of the ideas for the translator were gleaned by examining the output of RDS's EC (Euphoria to C) translator. I wrote my own yacc-inspired toolkit, called Ox. Given grammar rules, Ox reads input files and creates parse trees, which are then evaluated. I've used Ox on other projects, such as my Py programming language.
There's actually a fairly good mapping between Java and Euphoria. The core syntax is similar, and the data types align as well:
- integer is a 32 bit integer. These are implemented using Integer.
- atom is a 32 bit float. These are implemented with Double.
- sequence is a collection of any native datatype, including other sequences. These are implemented as a custom Seq class, essentially the same as a Vector.
- object is any of the above. These are implemented with the Object.
How Fast is Euphoria/Java?
Not very good, I fear. For example, it takes Euphoria about 2 seconds to run the Queens demo - and most of that time is spent on I/O. The current version runs in about 11 seconds on my machine. Clearly there is room for improvement, especially when my prior version ran in about 6 seconds.
How Complete is Euphoria/Java?
Most of the code language has been implemented, with the exception of short-circuiting boolean tests. However, virtially no function relating to files has been implemented, and many library functions are missing.
You need to have a copy of Euphoria installed in order to run Euphoria/Java, and a copy of Java to run the translated program.
From the command line, type: ej filename
Where filename is the name of the file you want to convert. The file will be converted into a Java program, compiled, and executed.
Just download the files, and unzip into a directory. These files have long file names, so make sure that the Java files have an extention of .java and not .JAV.
Download Euphoria/Java as of March 20, 2001 (93K).
Site last updated 09-21-2003