Parsing Ruby

I'm about to delve into the mysteries of parsing Ruby.

Some questions:

1. I seem to remember that ripper is "the future" of Ruby
    parsing, correct?

2. But apparently now we are still using parse.c which is
    generated by yacc?

3. My impression was that ripper itself could not create
    an AST... correct or no??

4. There have been various attempts at Ruby parsers *in Ruby*,
    I know... how mature are these? How accurate? How easy to
    understand the code?

5. What experts are around who are willing to answer questions
    from time to time?

Thanks,
Hal

I'm about to delve into the mysteries of parsing Ruby.

Some questions:

1. I seem to remember that ripper is "the future" of Ruby
    parsing, correct?

Not sure anymore, but I'd love to know.

2. But apparently now we are still using parse.c which is
    generated by yacc?

Right. In fact, Ripper does the same thing but gives you a Ruby
representation of the code....

3. My impression was that ripper itself could not create
    an AST... correct or no??

Ripper can create an AST.

4. There have been various attempts at Ruby parsers *in Ruby*,
    I know... how mature are these? How accurate? How easy to
    understand the code?

Ripper is in Yacc, C, and Ruby, but I would definitely take a look at
it. It's pretty easy to understand and relatively mature. Mark S. is
using (and enhancing) it for Cardinal.

5. What experts are around who are willing to answer questions
    from time to time?

If I were an expert, I would be willing. :slight_smile:

Chad

···

On Thu, 19 Aug 2004 18:18:07 +0900, Hal Fulton <hal9000@hypermetrics.com> wrote:

Thanks,
Hal

Hi,

  In mail "Parsing Ruby..."

I'm about to delve into the mysteries of parsing Ruby.

Some questions:

1. I seem to remember that ripper is "the future" of Ruby
    parsing, correct?

In this month I met matz and got an agreement to commit ripper
in the standard distribution. I'll commit it in the very near
future (in this weekend, for example).

At the same time, matz is saying that he is writing a new parser.
I don't know when it reaches production level.

2. But apparently now we are still using parse.c which is
    generated by yacc?

Ripper also uses yacc.
It is just an improvement patch for current parser.

3. My impression was that ripper itself could not create
    an AST... correct or no??

Mark Sparshatt is working for ripper based AST.
See ripper repository hosted on RubyForge.

Regards,
Minero Aoki

···

Hal Fulton <hal9000@hypermetrics.com> wrote:

Hal Fulton wrote:

I'm about to delve into the mysteries of parsing Ruby.

Some questions:

4. There have been various attempts at Ruby parsers *in Ruby*,
   I know... how mature are these? How accurate? How easy to
   understand the code?

Using Ripper I haven't had any troubles understanding the code (and that's despite the fact my c skills are very rusty)

5. What experts are around who are willing to answer questions
   from time to time?

I've been using Ripper as part of Cardinal and while I'm not an expert I'm willing to try and answer any questions you might have.

···

--
Mark Sparshatt

Thanks,
Hal