rslet' 

  class Mini &lt; Parslet::Parser
    rule(:integer) { match('[0-9]').repeat(1) }
    root(:integer)
  end

  Mini.new.parse("132432")  # =&gt; "132432"@0
</code></pre>
<p>Running this example will print &#8220;132432@0&#8221;. Congratulations! You just have
written your first parser. Running it on the input &#8216;<code>puts(1)</code>&#8217; will
not work yet. Let&#8217;s see what happens in case of a failure:</p>
<pre class="sh_ruby"><code> 
  Mini.new.parse("puts(1)") # raises Parslet::ParseFail