About


  require 'parslet'
  include Parslet

  # Constructs a parser using a Parser Expression Grammar 
  parser =  str('"') >> 
            (
              str('\\').ignore >> any |
              str('"').absent? >> any
            ).repeat.as(:string) >> 
            str('"')

  result = parser.parse %Q("this is a valid \\"string\\"")
  result # => {:string=>"this is a valid \"string\""@1}

A small Ruby library for constructing parsers in the PEG (Parsing Expression Grammar) fashion.

Parslet makes developing complex parsers easy. It does so by

Parslet takes the long way around to make your job easier. It allows for incremental language construction. Often, you start out small, implementing the atoms of your language first; parslet takes pride in making this possible.

Eager to try this out? Get started!