Ruby to Parrot compiler

R

Robert Feldt

Mark said:
This sounds like a Ruby version of Perls B::** modules, which I agree
would be a very good thing.

Though would it be best to do this by modifying the interpreter, or by
using one of Ripper, Ruth or Rocket?
I'm not 100% up to speed with Perls B::* modules but my vision for Ruth
was to do (what I think is) the same thing for Ruby: lift the internal
representation to the language level. This is useful no matter which
Ruby parser you eventually go for for a compiler project, IMHO since you
can test your stuff against it.

/Robert
 
N

Nathaniel Talbott

[Ripper] In theory should be in sync with Ruby's parser since it is
based on it but might lag if there are changes to Ruby's (although I
think changes are minor in practice). Downside: more work.

One thing about Ripper that I heard at the RubyConf (someone please
correct me if I'm wrong) is that matz plans on using it for Rite's
parser, so eventually it is guaranteed to always be in sync with the
most current Ruby. For that reason it seems like it would be great for
folks to be improving it now, as it means less work for matz in the
long run.


Nathaniel

<:((><
 
G

George Marrows

There are AFAIK at least two projects that convert Ruby code into
bytecode, I wonder how easy it would be to modify them so they emit
parrot bytecode? I admit I'm not clear about how they work.

One of these projects may be ByteCodeRuby [1]. Feel free to use
lib/bcr/compile.rb if it helps you and the licence (Ruby's) suits you.
Better to look in CVS rather than use the latest build, which is a
little old now.

However I'm not sure how good the fit will be. BCR works off a
DOM-style parser (Ruth) and compiles to a stack-based virtual machine.
It sounds like you might be using Ripper, which is SAX-style, and
compiling to Parrot, which is register-based.

-- George

[1] http://rubyforge.org/projects/bytecoderuby/
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top