1. Euphoria to Java

I've released another preview of my Euphoria to Java translator program. You
can find it on:

   http://www.lanset.com/dcuny/java.htm

For those too impatient to read all the details, you can just download it
at:

   http://www.lanset.com/download/java2.htm

It can now translate the Win32Lib demos EX03 through EX08 and run them using
Swing. If anyone has a Macintosh, I'd appreciate getting a screenshot. You
can change the look and feel by changing the parameter in the lookAndFeel()
function in WIN32LIB.EW.

Thanks to Jeff Fielding, who offered some ways to speed up the code, and put
up with my cries of panic as I struggled through Swing... smile

As always, feedback is appreciated! Has anyone looked at this yet?

Thanks!

-- David Cuny

new topic     » topic index » view message » categorize

2. Re: Euphoria to Java

I wrote:

>    http://www.lanset.com/download/java2.htm

It should have been:

  http://www.lanset.com/dcuny/download/java2.zip

Sorry!

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: Euphoria to Java

which Java --1.0a ,1.2, 1.3__? or is it not specific?
I had looked at 1.3 for the cadd like graphics (not included in the 1.2
version) and am very interested in this, I have downloaded  and will get a
look at it later this evening.

Swayze
mswayze at truswood.com
kswayze at bellsouth.net

----- Original Message -----
From: "David Cuny" <dcuny at LANSET.COM>
Sent: Tuesday, January 23, 2001 10:05 PM
Subject: Euphoria to Java


> I've released another preview of my Euphoria to Java translator program.
You
> can find it on:
>
>    http://www.lanset.com/dcuny/java.htm
>
> For those too impatient to read all the details, you can just download it
> at:
>
>    http://www.lanset.com/download/java2.htm
>
> It can now translate the Win32Lib demos EX03 through EX08 and run them
using
> Swing. If anyone has a Macintosh, I'd appreciate getting a screenshot. You
> can change the look and feel by changing the parameter in the
lookAndFeel()
> function in WIN32LIB.EW.
>
> Thanks to Jeff Fielding, who offered some ways to speed up the code, and
put
> up with my cries of panic as I struggled through Swing... smile
>
> As always, feedback is appreciated! Has anyone looked at this yet?
>
> Thanks!
>
> -- David Cuny
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Euphoria to Java

You know, for some reason I value your Eu To Java more
than I value Eu To C by RDS.
Why?
Because your code is open-source, in Eu, and you
produce source code only.

Infact, there are ways to turn your Eu To Java
translator into a Eu To C translator.
By using a Java To C translator, offcourse.
But what I'd appreciate in your program, would be some
kind of easy to use batch file that runs the program
that was compiled.
Installing a Java VM, JIT? Applet Class Bean Cup
Bytecoder 2.0 crapathon turd smuggler thing is a pain
in the ass.

In other words, it's hard for a Eu coder to actually
run the Java code produced.
Beating his way through tons of weird-ass products and
names like "Virtual Machine" and "Applet" and the
sorts.


But anyhow, Good work!

Mike The Spike
PS. Oh, and yeah, take out that code display thingy,
it was in your Basic To Eu translator too, it's
disturbing :(

> I've released another preview of my Euphoria to Java
> translator program. You
> can find it on:
>
>    http://www.lanset.com/dcuny/java.htm
>
> For those too impatient to read all the details, you
> can just download it
> at:
>
>    http://www.lanset.com/download/java2.htm
>
> It can now translate the Win32Lib demos EX03 through
> EX08 and run them using
> Swing. If anyone has a Macintosh, I'd appreciate
> getting a screenshot. You
> can change the look and feel by changing the
> parameter in the lookAndFeel()
> function in WIN32LIB.EW.
>
> Thanks to Jeff Fielding, who offered some ways to
> speed up the code, and put
> up with my cries of panic as I struggled through
> Swing... smile
>
> As always, feedback is appreciated! Has anyone
> looked at this yet?
>
> Thanks!
>
> -- David Cuny


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/

new topic     » goto parent     » topic index » view message » categorize

5. Euphoria to Java

For various and sundry reasons, I've been pondering a Euphoria to Java
translator. I've heard the arguments against Java - it's a slow, bloated
resource-hogging b&d style language. I used to believe some of them, but
with each new generation of PC, the requirements of Java seem more and more
modest. Additionally, the speed increases due to JIT compiler technology has
been nothing short of staggering.

Some time back, I had written a preliminary Euphoria to Java translator. You
can find it at:

   http://www.lanset.com/dcuny/java.htm

It's only capable of translating simple Euphoria programs. The project
stalled because I had trouble figuring out how to link it to Swing. As you
might guess, I've gotten back to the code more recently, and have been doing
some more experiments.

I've been spurred on mostly by Robert's Euphoria to C translator. There's
obviously a good enough mapping between C and Euphoria for his translator to
work. But it seems to me that an equally viable mapping exists between
Euphoria and Java. For example, here's a mapping of the basic data types:

   integer -> int, Integer
   atom -> long, Long
   sequence -> Vector

Robert's coding of sequences is:

   struct s1 {
      object_ptr first;
      long length;
      long ref;
      long postfill;
   }

Java already provides a mechanism for determining the length of a Vector,
and automatically maintains space for expansion. So the Java equivalent
could simply be:

   class EuObject {
      Object data;
      int refcount = 0;
   }

There's a close correlation in code generation as well. Here's an example:

   object o1, o2
   o1 = {1,2,3}
   o2 = o1[2]

Robert's translator generates:

    // o1 = {1,2,3}
    _0 = _0o1;
    _1 = NewS1(3);
    _2 = (int)((s1_ptr)_1)->first;
    *((int *)(_2+0)) = 1;
    *((int *)(_2+4)) = 2;
    *((int *)(_2+8)) = 3;
    _0o1 = MAKE_SEQ(_1);
    DeRef(_0);

    // o2 = o1[2]
    _0 = _0o2;
    _2 = (int)SEQ_PTR(_0o1);
    _0o2 = (int)*(1 + ((s1_ptr)_2)->first);
    Ref(_0o2);
    DeRef(_0);

Here's a guess at what the equivalent Java code might be:

   // o1 = {1,2,3}
   _0 = _0o1;
   _1 = new EuObject();
   _1.data = new Vector();
   _1.data.addElement( new Integer( 1 ) );
   _1.data.addElement( new Integer( 2 ) );
   _1.data.addElement( new Integer( 3 ) );
   _0o1 = _1;
   _1.DeRef();

   // o2 = o1[2]
   _0 = _0o2;
   _0o2 = _0o1.elementAt( 1 );
   _0o2.Ref();
   _0.DeRef();

Of course, it's sort of cheating not to show how Ref and DeRef might be
implemented:

   public void Ref() {
      // is the object is a sequence?
      if (this.data instanceof Vector) {
         // increment the reference count
         this.refcount += 1;
      }
   }

   public void DeRef() {
      // is the object a sequence?
      if (this.data instanceof Vector) {
         // decrement the reference count
         this.refcount -= 1;
      }

      // release the object. if there are no more
      // references to it, Java will garbage collect it.
      this = _null;
   }

The Java code isn't that different from the C code, and I *suspect* that the
resulting Java code would be acceptably fast.

If such a translator were written, Euphoria programs would be able to run on
a much wider base of machines - Macs, non-x86 based machines - anything that
Java has been ported to.

In addition, we'd also have access to the AWT and Swing. Anyone subscribed
to this list for any period of time knows that I'd love for Euphoria to have
a portable GUI.

So, assuming that the project is feasible, here comes the interesting
question:

   - Who wants to write it?

Robert is obviously in the best position to write this. Whether he is
interested in doing this, or even if such a project is commercially viable,
I couldn't guess.

Pete Eberlein is my number two pick, but he seems to have disappeared off
into the Land of Reality, that unhappy place of the 9 to 5 grind.

I suspect that I could do it, but there are other things that I'd rather do.

I've also got a sneaking feeling that *someone* is currently working on this
project, but it's nothing more than a hunch.

Comments?

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

6. Re: Euphoria to Java

I wish you the best. I can't help on this one. Overcommitted as it is.
Besides I want a Euphoria to Forth translator blink

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

new topic     » goto parent     » topic index » view message » categorize

7. Re: Euphoria to Java

Hi David,

How much less effort would it be to write a Euphoria -> Java translator
then it would be to write your own Euphoria -> C translator.

All the benefits you mention about Java exist in C,
as well C has speed and resource benefits.

Obvisously the current translator only supports the compilers
that Rob creates a library for.

If you had your own Translator you could compile it for any
development envirnonment you wanted to.

In actual fact you'd only need to write your own lib that emulates
what Rob has done and use the current Translator ... although I
don't know how legal or ethically correct that would be.

What ideas do you have in incorporating Swig into this Java Translator?

Also whatever ideas you have ... would the same or similiar concepts
work with the current Translator with GTK+ or wxWindows?

Ray Smith


> For various and sundry reasons, I've been pondering a Euphoria to Java
> translator. I've heard the arguments against Java - it's a slow, bloated
> resource-hogging b&d style language. I used to believe some of them, but
> with each new generation of PC, the requirements of Java seem more and
more
> modest. Additionally, the speed increases due to JIT compiler technology
has
> been nothing short of staggering.
>
> Some time back, I had written a preliminary Euphoria to Java translator.
You
> can find it at:
>
>    http://www.lanset.com/dcuny/java.htm
>
> It's only capable of translating simple Euphoria programs. The project
> stalled because I had trouble figuring out how to link it to Swing. As you
> might guess, I've gotten back to the code more recently, and have been
doing
> some more experiments.
>
> I've been spurred on mostly by Robert's Euphoria to C translator. There's
> obviously a good enough mapping between C and Euphoria for his translator
to
> work. But it seems to me that an equally viable mapping exists between
> Euphoria and Java. For example, here's a mapping of the basic data types:
>
>    integer -> int, Integer
>    atom -> long, Long
>    sequence -> Vector
>
> Robert's coding of sequences is:
>
>    struct s1 {
>       object_ptr first;
>       long length;
>       long ref;
>       long postfill;
>    }
>
> Java already provides a mechanism for determining the length of a Vector,
> and automatically maintains space for expansion. So the Java equivalent
> could simply be:
>
>    class EuObject {
>       Object data;
>       int refcount = 0;
>    }
>
> There's a close correlation in code generation as well. Here's an example:
>
>    object o1, o2
>    o1 = {1,2,3}
>    o2 = o1[2]
>
> Robert's translator generates:
>
>     // o1 = {1,2,3}
>     _0 = _0o1;
>     _1 = NewS1(3);
>     _2 = (int)((s1_ptr)_1)->first;
>     *((int *)(_2+0)) = 1;
>     *((int *)(_2+4)) = 2;
>     *((int *)(_2+8)) = 3;
>     _0o1 = MAKE_SEQ(_1);
>     DeRef(_0);
>
>     // o2 = o1[2]
>     _0 = _0o2;
>     _2 = (int)SEQ_PTR(_0o1);
>     _0o2 = (int)*(1 + ((s1_ptr)_2)->first);
>     Ref(_0o2);
>     DeRef(_0);
>
> Here's a guess at what the equivalent Java code might be:
>
>    // o1 = {1,2,3}
>    _0 = _0o1;
>    _1 = new EuObject();
>    _1.data = new Vector();
>    _1.data.addElement( new Integer( 1 ) );
>    _1.data.addElement( new Integer( 2 ) );
>    _1.data.addElement( new Integer( 3 ) );
>    _0o1 = _1;
>    _1.DeRef();
>
>    // o2 = o1[2]
>    _0 = _0o2;
>    _0o2 = _0o1.elementAt( 1 );
>    _0o2.Ref();
>    _0.DeRef();
>
> Of course, it's sort of cheating not to show how Ref and DeRef might be
> implemented:
>
>    public void Ref() {
>       // is the object is a sequence?
>       if (this.data instanceof Vector) {
>          // increment the reference count
>          this.refcount += 1;
>       }
>    }
>
>    public void DeRef() {
>       // is the object a sequence?
>       if (this.data instanceof Vector) {
>          // decrement the reference count
>          this.refcount -= 1;
>       }
>
>       // release the object. if there are no more
>       // references to it, Java will garbage collect it.
>       this = _null;
>    }
>
> The Java code isn't that different from the C code, and I *suspect* that
the
> resulting Java code would be acceptably fast.
>
> If such a translator were written, Euphoria programs would be able to run
on
> a much wider base of machines - Macs, non-x86 based machines - anything
that
> Java has been ported to.
>
> In addition, we'd also have access to the AWT and Swing. Anyone subscribed
> to this list for any period of time knows that I'd love for Euphoria to
have
> a portable GUI.
>
> So, assuming that the project is feasible, here comes the interesting
> question:
>
>    - Who wants to write it?
>
> Robert is obviously in the best position to write this. Whether he is
> interested in doing this, or even if such a project is commercially
viable,
> I couldn't guess.
>
> Pete Eberlein is my number two pick, but he seems to have disappeared off
> into the Land of Reality, that unhappy place of the 9 to 5 grind.
>
> I suspect that I could do it, but there are other things that I'd rather
do.
>
> I've also got a sneaking feeling that *someone* is currently working on
this
> project, but it's nothing more than a hunch.
>
> Comments?
>
> -- David Cuny

new topic     » goto parent     » topic index » view message » categorize

8. Re: Euphoria to Java

I've been thinking of writing a C or Java translator/interpreter. I had
written an Euphoria-like assembly language a while back with an
interpreter in C, but it wasn't as fast as I would have liked and the C
code was buggy. I just started trying to write a fast set of classes for
Euphoria objects in C++. I'm even pretty impressed with the speed, though
the I'm comparing interpreted Euphoria to compiled C++. I translated part
of the sequence benchmark, and here's the results so far:

Task                            exu             my program
s = repeat(999, 100)            811733          690667
z = x + y (both length 100)     210466          132933
appending to a sequence         5413333         6811670
slicing a sequence              2167500         3100000

So maybe with some more optimization, it would be worth it. What I've
really been interested in, however, is writing a combined translator and
optimizer that would automatically use primitive ints etc., like you
suggest, and also allocate arrays where applicable instead of sequences.
This would make the sieve benchmark, for example, almost as fast as a
hand-coded C version.

As for Java, I downloaded your Euphoria to Java translator, and it works
quite nicely for most simple Euphoria programs. I tweaked a bit of the
Java code and added some code to use built-in ints in for loops, which
increased the speed significantly. The problem with Java for translated
Euphoria programs, in my opinion, is that you can't do the kind of casting
you can in C with primitive types. In C, you could do:

struct sequence
{
        int *data;
        int count;
};

And you could make each element of data anything that can be stored in 4
bytes by doing something like (untested and my C is a little rusty):
sequence *s = ((sequence **)seq->data)[0];
int x = seq->data[0];
float f = ((float *)seq->data)[0];

But in Java, you have to use a whole class such as Integer. And what's
worse is that you can't re-assign Integers in Java, so every time you
modify it you have to create a new object. This makes it really, really
slow compared to using a primitive int.

So maybe I'll start working on an Euphoria to C/Java translator over
winter vacation...

Jeff

On Sat, 2 Dec 2000, David Cuny wrote:

> For various and sundry reasons, I've been pondering a Euphoria to Java
> translator. I've heard the arguments against Java - it's a slow, bloated
> resource-hogging b&d style language. I used to believe some of them, but
> with each new generation of PC, the requirements of Java seem more and more
> modest. Additionally, the speed increases due to JIT compiler technology has
> been nothing short of staggering.
>
> Some time back, I had written a preliminary Euphoria to Java translator. You
> can find it at:
>
>    http://www.lanset.com/dcuny/java.htm
>
> It's only capable of translating simple Euphoria programs. The project
> stalled because I had trouble figuring out how to link it to Swing. As you
> might guess, I've gotten back to the code more recently, and have been doing
> some more experiments.
>
> I've been spurred on mostly by Robert's Euphoria to C translator. There's
> obviously a good enough mapping between C and Euphoria for his translator to
> work. But it seems to me that an equally viable mapping exists between
> Euphoria and Java. For example, here's a mapping of the basic data types:
>
>    integer -> int, Integer
>    atom -> long, Long
>    sequence -> Vector
>
> Robert's coding of sequences is:
>
>    struct s1 {
>       object_ptr first;
>       long length;
>       long ref;
>       long postfill;
>    }
>
> Java already provides a mechanism for determining the length of a Vector,
> and automatically maintains space for expansion. So the Java equivalent
> could simply be:
>
>    class EuObject {
>       Object data;
>       int refcount = 0;
>    }
>
> There's a close correlation in code generation as well. Here's an example:
>
>    object o1, o2
>    o1 = {1,2,3}
>    o2 = o1[2]
>
> Robert's translator generates:
>
>     // o1 = {1,2,3}
>     _0 = _0o1;
>     _1 = NewS1(3);
>     _2 = (int)((s1_ptr)_1)->first;
>     *((int *)(_2+0)) = 1;
>     *((int *)(_2+4)) = 2;
>     *((int *)(_2+8)) = 3;
>     _0o1 = MAKE_SEQ(_1);
>     DeRef(_0);
>
>     // o2 = o1[2]
>     _0 = _0o2;
>     _2 = (int)SEQ_PTR(_0o1);
>     _0o2 = (int)*(1 + ((s1_ptr)_2)->first);
>     Ref(_0o2);
>     DeRef(_0);
>
> Here's a guess at what the equivalent Java code might be:
>
>    // o1 = {1,2,3}
>    _0 = _0o1;
>    _1 = new EuObject();
>    _1.data = new Vector();
>    _1.data.addElement( new Integer( 1 ) );
>    _1.data.addElement( new Integer( 2 ) );
>    _1.data.addElement( new Integer( 3 ) );
>    _0o1 = _1;
>    _1.DeRef();
>
>    // o2 = o1[2]
>    _0 = _0o2;
>    _0o2 = _0o1.elementAt( 1 );
>    _0o2.Ref();
>    _0.DeRef();
>
> Of course, it's sort of cheating not to show how Ref and DeRef might be
> implemented:
>
>    public void Ref() {
>       // is the object is a sequence?
>       if (this.data instanceof Vector) {
>          // increment the reference count
>          this.refcount += 1;
>       }
>    }
>
>    public void DeRef() {
>       // is the object a sequence?
>       if (this.data instanceof Vector) {
>          // decrement the reference count
>          this.refcount -= 1;
>       }
>
>       // release the object. if there are no more
>       // references to it, Java will garbage collect it.
>       this = _null;
>    }
>
> The Java code isn't that different from the C code, and I *suspect* that the
> resulting Java code would be acceptably fast.
>
> If such a translator were written, Euphoria programs would be able to run on
> a much wider base of machines - Macs, non-x86 based machines - anything that
> Java has been ported to.
>
> In addition, we'd also have access to the AWT and Swing. Anyone subscribed
> to this list for any period of time knows that I'd love for Euphoria to have
> a portable GUI.
>
> So, assuming that the project is feasible, here comes the interesting
> question:
>
>    - Who wants to write it?
>
> Robert is obviously in the best position to write this. Whether he is
> interested in doing this, or even if such a project is commercially viable,
> I couldn't guess.
>
> Pete Eberlein is my number two pick, but he seems to have disappeared off
> into the Land of Reality, that unhappy place of the 9 to 5 grind.
>
> I suspect that I could do it, but there are other things that I'd rather do.
>
> I've also got a sneaking feeling that *someone* is currently working on this
> project, but it's nothing more than a hunch.
>
> Comments?
>
> -- David Cuny
>

new topic     » goto parent     » topic index » view message » categorize

9. Re: Euphoria to Java

On Sat, 2 Dec 2000, Jeffrey Fielding wrote:

> Task                            exu             my program
> s = repeat(999, 100)            811733          690667
> z = x + y (both length 100)     210466          132933
> appending to a sequence         5413333         6811670
> slicing a sequence              2167500         3100000
By the way, the numbers for my program might be (a little) high because I
use the like following:

#include <time.h>
void main()
{
        time_t end_time = time(NULL)+15;
        while (time(NULL) < end_time)
        {
                do_benchmark
                cycles += whatever
        }
        cout << cycles/15 << endl;
}

Whereas Euphoria does more exact timing (since the time() function in
Euphioria is floating-point, and the time function in C is a 32-bit int),
and also I don't bother checking if it's taken a second more (as it
probably hasn't). If anyone knows how to do more exact timing in C, tell
me and I'll re-test it.

Jeff

new topic     » goto parent     » topic index » view message » categorize

10. Re: Euphoria to Java

Jeffrey Fielding wrote:

> But in Java, you have to use a whole
> class such as Integer. And what's
> worse is that you can't re-assign
> Integers in Java, so every time you
> modify it you have to create a new
> object. This makes it really, really
> slow compared to using a primitive int.

But if you created a pool of Integers (for example, in the range -1 to 255),
you could share those values. For example, here's the coding for adding two
objects:

   // o3 = o1 + o2

   // store old value
   _0 = 0o3;

   // are both values numeric?
   if !(_0o1 instanceof Vector || _0o2 instanceof Vector) {
      // perform addition
      _tmpLong = _0o1.data.longValue + _0o2.data.longValue;
      // is the result in the integer pool?
      if (_tmpLong.isInt() && _tmpLong >= -1 && _tmpLong <= 255) {
         // fetch pre-defined constant from the pool
         _1.data = _intPool[(int)_tmpLong + 1];
      } else {
         // create a new Integer
         _1.data = new Integer( _tmpLong );
   } else {
      // there's a sequence, use class method
      _1 = _binary_op( PLUS, _0o1, _0o2 );
   }

   // assign
   _0o3 - _1;

   // release temp
   _1 = _null;

   // dereference
   _0.DeRef();

More importantly, he wrote:

> So maybe I'll start working on an Euphoria
> to C/Java translator over winter vacation...

Are you serious about this? Do you want some help?

-- David Cuny



-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

11. Re: Euphoria to Java

How 'bout someone works up a Euphoria plug-in for browsers (MSIE &
Navigator), so we can have "Euphoria applets" or the equivalent, and an
architecture-neutral windowing system (based on Swing? unless we think we
can design better). Translating into Java is in some ways tantamount to
acknowledging Java is fundamentally superior, which I don't.

George
_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

new topic     » goto parent     » topic index » view message » categorize

12. Re: Euphoria to Java

On Sat, 2 Dec 2000, George Henry wrote:

> How 'bout someone works up a Euphoria plug-in for browsers (MSIE &
> Navigator), so we can have "Euphoria applets" or the equivalent, and an
> architecture-neutral windowing system (based on Swing? unless we think we
> can design better). Translating into Java is in some ways tantamount to
> acknowledging Java is fundamentally superior, which I don't.
>
> George
>
> _____________________________________________________________________________________
> Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com
>
Java does have the advantage of being able to run in most web browsers on
most platforms without any modification. And as much as I like Euphoria,
there are many languages out there that are, in some cases, fundamentally
superior. I have yet to see a language that beats Java's portability. For
pure speed, Assembly or C are certainly superior etc. Of course, for many
tasks, Euphoria rules. Anyway, I think euphoria applets would be a good
idea, but I'm not really interested in developing a plugin for every
browser on every platform... so I'd say translate them to Java.

Jeff

new topic     » goto parent     » topic index » view message » categorize

13. Re: Euphoria to Java

On Sat, 2 Dec 2000, David Cuny wrote:

> Jeffrey Fielding wrote:
>
> > But in Java, you have to use a whole
> > class such as Integer. And what's
> > worse is that you can't re-assign
> > Integers in Java, so every time you
> > modify it you have to create a new
> > object. This makes it really, really
> > slow compared to using a primitive int.
>
> But if you created a pool of Integers (for example, in the range -1 to 255),
> you could share those values. For example, here's the coding for adding two
> objects:
>
>    // o3 = o1 + o2
>
>    // store old value
>    _0 = 0o3;
>
>    // are both values numeric?
>    if !(_0o1 instanceof Vector || _0o2 instanceof Vector) {
>       // perform addition
>       _tmpLong = _0o1.data.longValue + _0o2.data.longValue;
>       // is the result in the integer pool?
>       if (_tmpLong.isInt() && _tmpLong >= -1 && _tmpLong <= 255) {
>          // fetch pre-defined constant from the pool
>          _1.data = _intPool[(int)_tmpLong + 1];
>       } else {
>          // create a new Integer
>          _1.data = new Integer( _tmpLong );
>    } else {
>       // there's a sequence, use class method
>       _1 = _binary_op( PLUS, _0o1, _0o2 );
>    }
>
>    // assign
>    _0o3 - _1;
>
>    // release temp
>    _1 = _null;
>
>    // dereference
>    _0.DeRef();
>

You might do that, but I think it would be faster (though I haven't tested
it) to do one of the following:
1. create a replacement for Integer etc. that lets you modify the value
2. create an interface, EuObject, and then make specific classes like
EuInteger, EuAtom, and EuSequence which implement that interface, but each
stores the value in the most efficient way
3. create a (slightly bloated) EuObject class with a way to store each
type:
class EuObject
{
        int iVal;
        double fVal;
        Vector sVal;
}

> More importantly, he wrote:
>
> > So maybe I'll start working on an Euphoria
> > to C/Java translator over winter vacation...
>
> Are you serious about this? Do you want some help?
>
> -- David Cuny
Well, I've started such a project several times, but I have yet to finish
it. I've been trying to come up with a neat way to parse an Euphoria
program and to represent it as a tree. For simply translating it, it's
not necessary to do this, but I want to optimize it too. Since it would
probably be easiest to represent such a tree with classes and pointers, I
tried doing this in Java. Unfortunately, I'm too impatient to design every
intricate detail of the program before writing it, so it got really ugly
fast.
Mostly, I'm interested in writing such a translator as an intellectual
challenge, but also I think it would be useful because then I might be
able to add stuff like object orientation to Euphoria, which would make
some tasks much easier. Pointers, though they can get really ugly, would
also make many tasks easier in Euphoria. I'd like to experiment with
features like those.
As part of a project I started a long while ago, I wrote an Euphoria
lexer, which seems to work quite nicely and it is pretty easily
extendible. I haven't been very successful (yet, anyway) at writing a
parser for those tokens. As I mentioned, I have a set of C++ classes for
Euphoria objects and sequences, with some basic routines implemented. They
seem to be reasonably fast, and they should automatically clean up unused
variables when they go out of scope.
So, if you'd like to help, that would be great. I have exams coming up
next week, but then a long break grin, so I'll probably not be able to do
all that much work on it until then.

Jeff

new topic     » goto parent     » topic index » view message » categorize

14. Re: Euphoria to Java

I don't have the time (nor the skills) to contribute to such a project, but
I think it'd be interesting if someone would manage to write a good
euphoria-to-java translator. Then I'd finally be able to do some euphoria
coding on the SUN puters at school..

_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

new topic     » goto parent     » topic index » view message » categorize

15. Re: Euphoria to Java

>How 'bout someone works up a Euphoria plug-in for browsers (MSIE &
>Navigator), so we can have "Euphoria applets" or the equivalent, and an
>architecture-neutral windowing system (based on Swing? unless we think we
>can design better). Translating into Java is in some ways tantamount to
>acknowledging Java is fundamentally superior, which I don't.
While you're at it, when I get a new PC, I can code support for Euphoria
CGI scripts into my web server!

 - Matt

new topic     » goto parent     » topic index » view message » categorize

16. Re: Euphoria to Java

>While you're at it, when I get a new PC, I can code support for Euphoria
>CGI scripts into my web server!

>- Matt

What? I assumed the server already had that.

George
_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

new topic     » goto parent     » topic index » view message » categorize

17. Re: Euphoria to Java

I am so new I don't know where this "post" is going.
Seems like a lot of work transcribing java code into Euphoria or do I have
that backwards?
  I see that we can call c_procedures from Euphoria and can have c-Programs
call us back to run a Euphoria procedure...(I haven't tried that yet).
I been look at Jscript in HTML and I can't image Euphoria doing it better,
but it would be nice to have your HTML call your Euphoria procedures.
I am not so sure you can't run Euphoria in a HTM , as long as ya have the
right "engine".
<script LANGUAGE="euphoria">
 puts(1,A)
</script> ..hmm guess I'll have to try that.

new topic     » goto parent     » topic index » view message » categorize

18. Re: Euphoria to Java

Absolutely.  Check the Euphoria archives for a thermometer program (DOS) written
by Jacques D. I think.  If your source data is a simple .DAT file updated once a
minute, the program could easily be less than a page long.

Michael J. Sabal

BTW:  Welcome to Euphoria, and programming in general.  You might want to just
start with modifying the demo programs to get a feel for what programming is
like, then move on to writing your own programs.  And of course, don't hesitate
to ask about anything you don't understand.  We all would be most willing to
help.

>>> dhagema at BELLSOUTH.NET 12/13/00 12:30PM >>>
----- Original Message -----
From: John <jwr6dmr at CS.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Wednesday, December 13, 2000 11:51 AM
Subject: Re: Euphoria to Java

> I am so new I don't know where this "post" is going.

I can top that. I am so new I've never written a stitch of code in any
language.

Does anyone know if it is possible to write a charting program using
realtime data with Euphoria.

new topic     » goto parent     » topic index » view message » categorize

19. Re: Euphoria to Java

----- Original Message -----
From: John <jwr6dmr at CS.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Wednesday, December 13, 2000 11:51 AM
Subject: Re: Euphoria to Java

> I am so new I don't know where this "post" is going.

I can top that. I am so new I've never written a stitch of code in any
language.

Does anyone know if it is possible to write a charting program using
realtime data with Euphoria.

new topic     » goto parent     » topic index » view message » categorize

20. Re: Euphoria to Java

Hello John

Think of Euphoria (interpreted) as the script and your code as the HTML

I think someone is working on the translator to Java but not Java to Eu.
euman at bellsouth.net

----- Original Message -----
From: John <jwr6dmr at CS.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Wednesday, December 13, 2000 11:51 AM
Subject: Re: Euphoria to Java


> I am so new I don't know where this "post" is going.
> Seems like a lot of work transcribing java code into Euphoria or do I have
> that backwards?
>   I see that we can call c_procedures from Euphoria and can have
c-Programs
> call us back to run a Euphoria procedure...(I haven't tried that yet).
> I been look at Jscript in HTML and I can't image Euphoria doing it better,
> but it would be nice to have your HTML call your Euphoria procedures.
> I am not so sure you can't run Euphoria in a HTM , as long as ya have the
> right "engine".
> <script LANGUAGE="euphoria">
>  puts(1,A)
> </script> ..hmm guess I'll have to try that.
>

new topic     » goto parent     » topic index » view message » categorize

21. Re: Euphoria to Java

Ba hum bug..
I spent the last four days working on HTML to anything.. now my head really
hurts.
1.Jscript Javascript are a little different and JAVA is a C++ on coffee...
2. Java hurts my eyes so I don't look at it.. javaScript is pretty cool..

I want to launch an application from the HTML ,browser window, but
something is fighting me.. I can click a link and bam it pop ups and runs.
I just can't figure how to get the code to do that ..
 I tried to call a batch file (with a euphoria thingie "ex prog.ex")
and it gives me the download box ("run virus now or save for later?"),which
defeats the whole purpose ...
also everything about HTML is "transient" and getting any data to save to
file is really hard...
maybe I am doing this backwards and I should be calling HTMLs from euthoria
so they can "show" their data and then close.  But how would I past data to
the HTML?

new topic     » goto parent     » topic index » view message » categorize

22. Re: Euphoria to Java

Hello John, If I'm not mistaken KAT from the list has done somethings
with HTML David Cuny too, maybe I'm wrong but try this,
Go to the Euphoria Web Site and click the header for Mailing List
and do a search for HTML or Java and see what pops up on the
subject. I personally dont like Java or Html (markup lang) so I couldn't
help
you other than point you to prior post.

Besides, I think what your trying to do is mainly secretive and not many
(if they were to figure out this problem your haveing) would be so kind to
share it with you.

euman at bellsouth.net


----- Original Message -----
From: John <jwr6dmr at CS.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, December 16, 2000 11:14 AM
Subject: Re: Euphoria to Java


> Ba hum bug..
> I spent the last four days working on HTML to anything.. now my head
really
> hurts.
> 1.Jscript Javascript are a little different and JAVA is a C++ on coffee...
> 2. Java hurts my eyes so I don't look at it.. javaScript is pretty cool..
>
> I want to launch an application from the HTML ,browser window, but
> something is fighting me.. I can click a link and bam it pop ups and runs.
> I just can't figure how to get the code to do that ..
>  I tried to call a batch file (with a euphoria thingie "ex prog.ex")
> and it gives me the download box ("run virus now or save for
later?"),which
> defeats the whole purpose ...
> also everything about HTML is "transient" and getting any data to save to
> file is really hard...
> maybe I am doing this backwards and I should be calling HTMLs from
euthoria
> so they can "show" their data and then close.  But how would I past data
to
> the HTML?
>

new topic     » goto parent     » topic index » view message » categorize

23. Re: Euphoria to Java

On 16 Dec 2000, at 11:14, John wrote:

> Ba hum bug..
> I spent the last four days working on HTML to anything.. now my head really
> hurts. 1.Jscript Javascript are a little different and JAVA is a C++ on
> coffee... 2. Java hurts my eyes so I don't look at it.. javaScript is pretty
> cool..
>
> I want to launch an application from the HTML ,browser window, but
> something is fighting me.. I can click a link and bam it pop ups and runs. I
> just can't figure how to get the code to do that ..
>  I tried to call a batch file (with a euphoria thingie "ex prog.ex")
> and it gives me the download box ("run virus now or save for later?"),which
> defeats the whole purpose ... also everything about HTML is "transient" and
> getting any data to save to file is really hard... maybe I am doing this
> backwards and I should be calling HTMLs from euthoria so they can "show" their
> data and then close.  But how would I past data to the HTML?
>

Have Eu write the data to a file, with pretty html formatting, then tell
windoze to open the .htm file. It will open it with IE real pronto, executing
the html, not the Eu.

Kat

new topic     » goto parent     » topic index » view message » categorize

24. Re: Euphoria to Java

I did not mean to attach myself to this thread, the original "euphoria to
Java" question.. but since I am here. thanks everyone, I found every reply
useful and in synch with what I thought was happening...
KAT I will do exactly as you suggested that is probably the best if not
quickest way to ouput EUPHORIA to an HTML/Browser. It certainly would let
you pass mountains of Data to the Browser. Getting the mountain back to
Euphoria may be a problem...

new topic     » goto parent     » topic index » view message » categorize

25. Re: Euphoria to Java

> -----Original Message-----
> From: John

> I want to launch an application from the HTML ,browser window, but
> something is fighting me.. I can click a link and bam it pop
> ups and runs.
> I just can't figure how to get the code to do that ..
>  I tried to call a batch file (with a euphoria thingie "ex prog.ex")
> and it gives me the download box ("run virus now or save for
> later?"),which
> defeats the whole purpose ...
> also everything about HTML is "transient" and getting any
> data to save to
> file is really hard...
> maybe I am doing this backwards and I should be calling HTMLs
> from euthoria
> so they can "show" their data and then close.  But how would
> I past data to
> the HTML?

What you're looking to do is something like cgi (server side scripting).
There have been some contributions on this (the most notable, IIRC, from Irv
Mullins).  Search the archives for CGI.  Some things you should know:

You'll need a web server that will allow you cgi, and will allow you to run
executables.  You'll need to be running your own server (PWS--comes with
Win9X, IIS--comes with WinNT/2000, Apache, etc) or else pay to have this
functionality.

If you'd like a free site to do server side scripting, your best bet may be
using MS Active Server Pages (ASP).  There are several sites that will offer
this.  The scripting is typically done in VB Script, although you can also
use javascript.

Matt Lewis

new topic     » goto parent     » topic index » view message » categorize

26. Re: Euphoria to Java

On 18 Dec 2000, at 15:20, John wrote:

> I did not mean to attach myself to this thread, the original "euphoria to
> Java" question.. but since I am here. thanks everyone, I found every reply
> useful and in synch with what I thought was happening... KAT I will do exactly
> as you suggested that is probably the best if not quickest way to ouput
> EUPHORIA to an HTML/Browser. It certainly would let you pass mountains of Data
> to the Browser. Getting the mountain back to Euphoria may be a problem...
>

Not really, use the winsock. You can have the html post command send
the data to localhost:AnyPortYouChoose , and have an Eu app listening
there. Then if you like, the Eu program could return munged data back to
the browser.

Btw, you wrote in another email about javascript and activex,, i won't allow
either to run on my puter, because they have bugs, and access to the rest
of the puter.


Kat

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu