Searching for a working Ruby parser

Hey folks!

I’m searching for a working Ruby parser. I found:
coco-ruby 1.0.0
antlr(antlr3rubytarget)

I tried both but they didn’t worked for me. (Perhaps I did something
wrong…)

Does anyone of you uses / knows a working parser for Ruby?
Thanks for your help.

sala

On Jan 25, 2008, at 9:24 AM, Saladin M. wrote:

I’m searching for a working Ruby parser. I found:
coco-ruby 1.0.0
antlr(antlr3rubytarget)

I tried both but they didn’t worked for me. (Perhaps I did something
wrong…)

Does anyone of you uses / knows a working parser for Ruby?

I made my own Ghost Wheel library for generating parsers:

http://rubyforge.org/projects/ghostwheel/

It’s still young, so I’m sure it has rough edges but I’ve used it for
a few tasks now. The documentation hasn’t been written yet, but I did
show a sample of usage on my blog:

http://blog.grayproductions.net/articles/ghost_wheel_example

You may also want to look at the Treetop parser:

http://rubyforge.org/projects/treetop

Hope that helps.

James Edward G. II

On Jan 25, 2008 9:24 AM, Saladin M. [email protected] wrote:

Hey folks!

I’m searching for a working Ruby parser. I found:
coco-ruby 1.0.0
antlr(antlr3rubytarget)

Also see

Dhaka
http://dhaka.rubyforge.org/
Racc
http://i.loveruby.net/en/projects/racc/

Daniel Brumbaugh K.

On Jan 25, 2008, at 07:24 , Saladin M. wrote:

Does anyone of you uses / knows a working parser for Ruby?
Thanks for your help.

Parser generator (for any grammar specified) or a ruby parser?

Thank you very much for your help.

I forgot to say that I also tried dhaka and racc (but thanks Daniel).
There were problems getting them to run, so that I throwed them away to
look for a working parser.

Again, perhaps I’m just incompetend :slight_smile: to use them.

@James: Ghost Wheel looks very interesting. I will try it out. Also
TreeTop looks interesting!

Ryan D. wrote:

Parser generator (for any grammar specified) or a ruby parser?

Parser generator for Ruby Code

Example:
class X
def y()
puts “y”
end
end

Shall be parsed into a tree so that each element like class/method
definition, arguments, parameters, variables… has its own leaf inside
the tree.

Sala

Hi Daniel,

I just found Treetop and I was waiting for such a lib for quite a time
now, not able to code it myself :slight_smile:
Can you compare Treetop and Dharka ?
Which one do you prefer ?

Mickael Faivre-Maçon

On Jan 26, 2008 7:16 PM, Daniel Brumbaugh K.

I you want some help getting started, I’ve been learning both Treetop
and Dhaka for the last month or so and would be happy to help you get
started. (Not that I’m necessarily any good at them, but I’ve made
them work at least.) Ghost Wheel look nice, so I might try learning
that too. I can be found loitering on irc://irc.freenode.net/#rubyunix

Daniel Brumbaugh K.

Saladin M. wrote:

Ryan D. wrote:

Parser generator (for any grammar specified) or a ruby parser?
Parser generator for Ruby Code

Check out the post at
http://www.infoq.com/news/2007/12/ruby_ruby_parser
for the status on a pure Ruby parser for Ruby.

I believe that Nathan Sobo is planning to write a Ruby parser in
Treetop.
Much easier than trying to do it with a limited-lookahead parser like
racc,
even though Ryan seems to have achieved it :-). And obviously MRI
does…

Clifford H…

Clifford H. wrote:

Check out the post at
http://www.infoq.com/news/2007/12/ruby_ruby_parser

thanks for this website. the ruby_parser looks good.

I will also try it

On Jan 29, 2008, at 13:47 , Saladin M. wrote:

Clifford H. wrote:

Check out the post at
http://www.infoq.com/news/2007/12/ruby_ruby_parser

thanks for this website. the ruby_parser looks good.

I will also try it

I wouldn’t, and I wrote it. :slight_smile:

Seriously, ruby_parser is slow, ugly, and … ugly.

Look at ParseTree instead. ruby_parser will catch up, but it’ll take
time.