Does ParseTree solve your problem?

http://rubyforge.org/projects/parsetree/

 - James Moore