Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A small PEG based parser library. See the Hacking page in the Wiki as well.

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 example
Octocat-spinner-32 experiments
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 Guardfile
Octocat-spinner-32 HISTORY.txt
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 parslet.gemspec

Parslet makes developing complex parsers easy. It does so by

* providing the best <b>error reporting</b> possible
* <b>not generating</b> reams of code for you to debug

Parslet takes the long way around to make <b>your job</b> 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

Eager to try this out? Please see the associated web site:


  require 'parslet'
  include Parslet

  # Constructs a parser using a Parser Expression Grammar like DSL: 
  parser =  str('"') >> 
              str('\\') >> any |
              str('"').absnt? >> any
            ) >> 
  # Parse the string and capture parts of the interpretation (:string above)        
  tree = parser.parse('"This is a \\"String\\" in which you can escape stuff"')

  tree # => {:string=>"This is a \\\"String\\\" in which you can escape stuff"}

  # Here's how you can grab results from that tree:

  transform = do
    rule(:string => simple(:x)) { 
      puts "String contents: #{x}" }


This library should work with most rubies. I've tested it with MRI 1.8, 1.9, 
rbx-head, jruby. Please report as a bug if you encounter issues.


At version 1.1 - Good basic functionality and lots of plans for extension.

(c) 2010 Kaspar Schiess
Something went wrong with that request. Please try again.