This post originated from an RSS feed registered with Ruby Buzz
by Ryan Davis.
Original Post: Meet the Fam'
Feed Title: Polishing Ruby
Feed URL: http://blog.zenspider.com/index.rdf
Feed Description: Musings on Ruby and the Ruby Community...
This is the world I'm living in right now... Let me introduce you to the fam'.
The core of the fam here is the ruby2c tool chain. That includes: ParseTree, an independent package that mines ruby's internals for method syntax trees; Rewriter and R2CRewriter, layers that make language translation easier; TypeChecker, a type inference engine for ruby; and finally RubyToC, which translates a subset of ruby into static C code. We released a beta of ruby2c in February and are still working on it in parallel with our work on metaruby.
Also related to ParseTree are ABC, Dep, Graph and ruby2ruby. They are much more in the "toy" category, mainly in the amount of polish more than utility. ABC, Dep, and Graph help you analyze code and visualize code complexity and relationships. ABC generates whitespace independent complexity metrics. Dep shows very basic dependencies between classes/methods. Graph translates parse tree output into a DOT file for the GraphViz tools.
Ruby2Ruby translates the output of ParseTree back into ruby. At first glance, it doesn't sound very useful. After all, you started with ruby, right? Why translate it back to ruby?. But imagine how many things you can build on this foundation: syntax highlighters, indentation tools, code annotation tools, enhanced debugging output, and truly awesome dynamic optimizers/rewriters/inliners. There are a lot of possibilities sitting on top of this 150 lines of code.
ZenTest is my test auditing and generation tool. It analyzes your implementation and unit tests and generates missing methods (both test and implementation) based on naming convention (Blah#blah should be tested by TestBlah#test_blah). It is my hope to tie ZenTest, ABC, and Graph together so you can visualize your test and implementation interdependencies and focus on the writing tests where they are most needed, based on complexity.
The blue nodes are things we haven't written yet, but hope to in the near future. ZenHack is going to be a repository of useful tools for hacking on ruby, prototyping, and generally playing with the language. It will tie into a lot of the tools above by using and abusing them. Parser will eventually be a full fledged pure ruby parser that we can use to feed ruby2c and can also feed to ruby2c. We also have planned two new tails to the ruby2c tool pipeline, one to generate extension code for regular ruby extensions and another to generate code for metaruby itself. The current ruby2c translator was a throwaway proof of concept.
So, that is the fam! Ruby community, the fam. Fam, the ruby community. I hope to see you mingling soon and enjoying each other as much as I have.