In article <AE7D2272-69BE-11D8-8CCB-000502FDD5CC / mac.com>,
Mark Hubbart <discord / mac.com> wrote:
>
>On Feb 27, 2004, at 9:37 PM, Curt Hibbs wrote:
>
>> Or, how about instead of doing a compiler to emit machine code for some
>> particular architecture, instead do it to emit byte codes for the
>> Parrot VM?
>>
>> In other words, join the Cardinal project and help it to forge ahead!
>
>Well... for me to work on either project, I will have to do a lot of
>brushing up on various things :) I have a feeling I won't actually get
>around to doing anything for at least a couple months, regardless.
>
>But when I do, I think Cardinal would be a good project for me to pore
>over. They would both be parsing Ruby and translating it into,
>basically, another language :) Perhaps the C translation could even
>build off of work done on cardinal! Parse the tree, then emit either
>cardinal bytecode, or C code. So I think helping with the cardinal
>project would benefit both projects.
There are several projects that could benefit. I actually think that what
we need is some directed effort put into a Ruby parser (frontend) of some
sort and then other (backend) projects like Cardinal could be plugged in.
It should be a whole other project (some already exist, like Ripper, Ruth,
Rockit, etc.) that is architected in such a way that it's easy to plug in
different backends like:
Cardinal (emits Parrot bytecode)
Ruby2C (emits C code)
Ruby2Java(emits Java)
Ruby2Rite(emits Rite bytecode)
....etc.
>
>What are the chances of Cardinal having the ability to emit more than
>one type of code structure for the tree it parses? Could it possibly
>end up pluggable?
Why not, there's really not code or architecture to Cardinal yet.
However, I'm proposing that Cardinal just be a 'backend' project
(meaning that given some sort of AST it emits Parrot bytecode) and
that another frontend project be created to actually Parse Ruby. This
frontend project should be architected in such a way that it's easy to
plug in different backends.
It could be that this frontend project already exists (I would tend to
thing so) in the form of Ripper or Ruth or Rockit. We just need to get a
consensus as to which of those projects to direct resources toward.
Phil