On Jan 31, 2012, at 09:30 , Bartosz Dziewoski wrote:

> For heavy lifting, there's always Racc. ruby_parser uses it, and it's
> pretty fast.
> 
> http://i.loveruby.net/en/projects/racc/
> http://rubygems.org/gems/racc
> http://rubydoc.info/gems/racc/1.4.7/frames

I did, but with all the complexity of ruby_parser, not the grammar in this thread. I did both the 10k testcase above as well as 10k lines of puts(2 + 3) on both ruby 1.8 and 1.9:

1.8:

116.05s:    86.17 l/s:    6.23 Kb/s:  722 Kb:10000 loc:../dev/blah1_10k.rb
  8.68s:  1152.15 l/s:   13.50 Kb/s:  117 Kb:10000 loc:../dev/blah2_10k.rb

1.9:

 84.80s:   117.92 l/s:    8.52 Kb/s:  722 Kb:10000 loc:../dev/blah1_10k.rb
  5.48s:  1825.23 l/s:   21.39 Kb/s:  117 Kb:10000 loc:../dev/blah2_10k.rb

Not an entirely fair comparison by using ruby_parser instead of an incredibly restrained grammar... but there you have it.

That said, I will say that I only barely tolerate LR based parser generators. I would love to have a fully conformant LL-based parser for ruby. I'm not convinced it is possible as ruby's grammar is seriously fucked up.