Forum: Ruby Best lexer/parser for Ruby language itself

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Anatol P. (Guest)
on 2005-12-21 13:30
(Received via mailing list)
Hi, all.

I need to do following thing: I have some program on ruby and I would
parse this program, do some manipulations with code and write back it to

Manipulations with sourcecode quite simple, like changing from
  puts 2 if a.nil?
  if a.nil?
    puts 2

or %Q{hello world} -> "hello world"

program is very similar to ruby code beautifier (and probably will be
somewhere in the future).

I am looking for articles/documents with theory background in this area
well as example programs (better on ruby)

Could you also help me with choosing what is the best lib for doing
that. I
saw bunch of ruby parser/lexer libs among them: grammar, parsetree,
rubylexer, syntax, ripper. I dont know what is the best for my task. And
dont know from what to start. Could you give me any advice on that?
This topic is locked and can not be replied to.