Library for constructing parsers and pretty printers based on invertible syntax descriptions
ZIO Parser describes a grammar once, as a Syntax, and uses that description in both directions: it parses text into values and prints values back to text. Because one value drives both, a parser and its pretty printer cannot drift apart.
The library gives you small building blocks (characters, strings, regexes), operators to combine them, and error values that say where and why a parse failed.
Add ZIO Parser to your build.sbt. It is published for Scala 2.12, 2.13 and 3.
On the JVM, use %%:
libraryDependencies ++= Seq(
// ZIO Parser: syntaxes, parsers, printers and regexes (JVM)
"dev.zio" %% "zio-parser" % "0.1.12"
)On Scala.js and Scala Native, use %%%:
libraryDependencies ++= Seq(
// ZIO Parser: syntaxes, parsers, printers and regexes (Scala.js and Scala Native)
"dev.zio" %%% "zio-parser" % "0.1.12"
)- Getting Started: parse and print your first value.
- Printing and Invertible Syntaxes: the idea behind one syntax that both parses and prints.
- Syntax, Regex, Error Handling, Parser Reference and Printer Reference: the API.
- Tutorial: Parse and Print a Config Language, Example: a JSON Syntax and Example: a GraphQL Parser: step-by-step learning.
- How-to Guides: whitespace and comments, nested data, readable error messages, streaming output and performance.
- Resources: talks and further reading.
Learn more on the ZIO Parser homepage!
For the general guidelines, see ZIO contributor's guide.
See the Code of Conduct