File: index.html.textile

package info (click to toggle)
ruby-parslet 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,260 kB
  • sloc: ruby: 6,157; sh: 8; javascript: 3; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,075 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
layout: layout
title: About
---


<pre class="sh_ruby"><code>
  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}
</code></pre>

A small Ruby library for constructing parsers in the
"PEG":http://en.wikipedia.org/wiki/Parsing_expression_grammar (Parsing
Expression Grammar) fashion.


Parslet makes developing complex parsers easy. It does so by

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

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":get-started.html!