[ANN] parslet 1.2 - a PEG parser library

K

Kaspar Schiess

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
* https://github.com/kschiess/parslet

Installation:

gem install parslet

Changes:

* All parsers are now parser atoms as well. Not only can you freely
combine atoms, you can mix in parsers! Example:

str('ip:') >> IpParser.new >> str(';')

* Parslet now returns slices instead of strings. Slices are strings
that retain original source offsets and are printed as "string"@0.
This allows line and column information to be accessed in later
stages: See Parslet::Slice for details.

* #prsnt? and #absnt? are now deprecated. Please use only #present? and
#absent

Synopsis:

require 'parslet'
class Mini < Parslet::parser
rule:)integer) { match('[0-9]').repeat(1) }
root:)integer)
end

Mini.new.parse("132432") # => "132432"@0

Go wild. Write that compiler!

[1] http://en.wikipedia.org/wiki/Parsing_expression_grammar
 
J

Jos Backus

[Note: parts of this message were removed to make it a legal post.]

Thanks for your continued work on this, Kaspar!

Jos
 
S

Suraj Kurapati

Kaspar Schiess wrote in post #986429:
* #prsnt? and #absnt? are now deprecated.
Please use only #present? and #absent

Hurray for improved readability! This is a good change. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top