gabrielelana / paco

A parser combinator library for Elixir
MIT License
31 stars 3 forks source link

Paco

Build Status

Parse everything with Elixir

Paco is a monadic parser combinator library written in Elixir. Goals:

WARNING: This is a work in progress, is not ready for use, so don't use it yet.

Example

defmodule Expression do
  use Paco

  parser expression do
    one_of([number, expression]) |> separated_by(",") |> surrounded_by("(", ")")
  end
end

Expression.parse("(7, (4, 5), (1, 2, 3), 6)") # => [7, [4, 5], [1, 2, 3], 6]