parslet is a Parsing Expression Grammar based[1] parser generator
library. Uff. Now that is out of our system, here goes what it really
does: It makes writing parsers pleasant for the rest of us. No code
generation, clear access to data, unit testable.
- http://kschiess.github.com/parslet/index.html
- GitHub - kschiess/parslet: A small PEG based parser library. See the Hacking page in the Wiki as well.
Installation:
gem install parslet
Changes:
- A better behaved context object for the variable-syntax in transform
blocks. It now behaves like any Ruby object with instance variables
and attribute readers. - An experimental micro-VM based implementation of the parsing engine
to get around limitations of Ruby 1.9.3 fibers. (stack size) - Several small bugs and gotchas in relation to other libraries are
now fixed.
Synopsis:
require ‘parslet’
class Mini < Parslet::Parser
rule(:integer) { match(‘[0-9]’).repeat(1) }
root(:integer)
end
Mini.new.parse(“132432”) # => 132432
‘parsing. for when you need it.’
[1] Parsing expression grammar - Wikipedia
[2] press play on tape – Parslet and its friends