Best lexer/parser for Ruby language itself

A

Anatol Pomozov

------=_Part_2535_24192139.1135164518028
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi, all.

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

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

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 as
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 I
dont know from what to start. Could you give me any advice on that?
 

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

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top