[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[Rite] Byte-Code Compiler in Ruby

Michael Neumann

11/16/2003 10:11:00 PM

Hi,

I am fascinated by the many new ideas presented by matz for Rite.

Why not write the whole Ruby-to-Bytecode compiler in Ruby itself?

As the compilation step is executed less frequently, due to having lots
of precompiled bytecode binaries (one for each .rb file), this step is
not very time-critial (it's only done once for each file). And
applications using eval() are seldom evaluating very large parts of
code, or are itself time-critical.

This way, the Ruby-to-Bytecode compiler could be compiled itself into
bytecode, and then run on top of the Bytecode interpreter.

As one side-effect, the Bytecode interpreter would become relative easy
to implement. The compiler, too. And some other cool effects could be
done this way.

Is this "old" idea realistic for Rite?

Regards,

Michael

2 Answers

gabriele renzi

11/16/2003 11:19:00 PM

0

il Mon, 17 Nov 2003 07:11:19 +0900, Michael Neumann
<mneumann@ntecs.de> ha scritto::

>Hi,
>
>I am fascinated by the many new ideas presented by matz for Rite.
>
>Why not write the whole Ruby-to-Bytecode compiler in Ruby itself?
>

google for 'metaruby'. You may discover something like this is being
done and is not so easy..

george.marrows

11/17/2003 11:04:00 AM

0

> Is this "old" idea realistic for Rite?

I would say yes. ByteCodeRuby's compiler is implemented in Ruby, which
greatly simplifies things. I haven't looked at the speed of
compilation, which will of course be slower than a C-based version,
but I agree with you that this isn't likely to critically affect
overal performance.

Quick plug: ByteCodeRuby is a (as yet incomplete) bytecode compiler
and interpreter for Ruby. For simplicity it reuses a lot of the
current VM, sharing its parser, class model, standard library and GC.
Version 0.2.0 has just been released on rubyforge:
http://rubyforge.org/projects/byt...

-- George