Sha256: 06bd14e34e92c45943405c7288e282a26633244124f638fbd972f3d769244c8f

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

# Dolos

## What is Dolos?
Dolos is parser combinator library for Ruby. It is inspired by FastParse and Scala Parser Combinators.

## What are parser combinators?
Parser combinators are a way to build parsers from smaller parsers. For example, you can build a parser for a number from a parser for a digit.
This is a very simple example, but it can be used to build more complex parsers.
Parsers are lazy and only run when needed. This allows to build complex parsers before passing input to them.
```ruby
hello = string("Hello")
greeting = hello >> c(" ") >> string("Ruby developer!")
greeting.run("Hello Ruby developer!") # => Success
```

## What's different from alternatives?
This library focuses on two things:
- Parsers integrate well into Ruby code. There is no need to keep them in separate classes.
- Fine grained control over parsers. You can `map` and adjust each parser separately
- Two ways of capturing values: traditional `>>`, other product operators to construct value and `capture!`
  - For simple parsers `capture!` can be used to very quickly capture values into flat arrays 
- Running parsers will not throw exceptions and instead return a result object. Exceptions don't play well with parsing.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dolos-0.3.1 docs/README.md
dolos-0.3.0 docs/README.md