[Rite] Byte-Code Compiler in Ruby

M

Michael Neumann

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
 
G

gabriele renzi

il Mon, 17 Nov 2003 07:11:19 +0900, Michael Neumann
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..
 
G

George Marrows

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/bytecoderuby/

-- George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top