Searching for a working Ruby parser

S

Saladin Mundi

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
 
J

James Gray

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 Gray II
 
S

Saladin Mundi

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 :) to use them.

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

Ryan said:
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
 
D

Daniel Brumbaugh Keeney

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 Keeney
 
M

Mickael Faivre-Macon

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 :)
Can you compare Treetop and Dharka ?
Which one do you prefer ?

Mickael Faivre-Ma=E7on

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 Keeney



--=20
Mickael.
Coding an AI ! http://faivrem.googlepages.com/antbattle
 
C

Clifford Heath

Saladin said:
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 Heath.
 
R

Ryan Davis

thanks for this website. the ruby_parser looks good.

I will also try it

I wouldn't, and I wrote it. :)

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

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

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

Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top