galexy / transfigure

Scala parser combinator library that transforms sequences

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transfigure Parser Library https://travis-ci.org/galexy/transfigure.svg?branch=gsy-ci-scaffold

Welcome

Transfigure is a yet another parser combinator library. This library is meant was an exploration into building parsers using functional techniques and to extend the functionality with better error handling than the scala-parser-combinators library. It supports the applicative style which yields more concise code than the monadic form.

Documentation

None at this time

Example

import net.reasoning.transfigure._
import cats.Applicative
import cats.implicits._
import cats.syntax.applicative._

case class Nonsense(foo: String, bar: String, baz: String)

object ExampleParsers extends StringParsers {
  def foo = string("foo")
  def bar = string("bar")
  def baz = string("baz")

  def nonsense = pure(Nonsense.apply _) <*> foo <*> bar <*> baz
}

object Main extends App {
  val reader = StringReader("foobarbaz")
  val result = ExampleParsers.nonsense(reader)
}

About

Scala parser combinator library that transforms sequences

License:MIT License


Languages

Language:Scala 100.0%