Ola Bini wrote:
> It seems to me that a first step for this would be to have the current 
> parser output Java source code, which uses JRuby internals to create 
> Ruby-classes in the way the builtin classes are defined right now (like 
> RubyString and RubyTime, etc). It really doesn't seem that hard to output 
> that kind of code, or am I missing something deep here?

Hi all,

I did an attempt to do this a few years ago, with essentially this
approach. The major difference would be that I generated JVM bytecode
directly, instead of going through Java source code. This enables much
faster compilation, but may have added some complexity to it. But
generating source code isn't exactly a "clean" solution either and JVM
bytecode is surprisingly simple.
If I recall correctly, I defined a kind of intermediate byte-code,
essentially the parse-tree nodes flattened, and then compiled those into
JVM bytecode. Using YARV's byte-code definitions for this could be an
interesting approach.

So in short, no, it isn't that hard, but it's a kind of big task to go
through every kind of parse-tree node and write the code for it.

/Anders




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel

Reply via email to