Scallion is a library for writing parsers and pretty printers for LL(1) languages in Scala.
A comprehensive Scaladoc API is available online.
Scallion uses a novel parsing algorithm that we have described in the PLDI'20 paper: Zippy LL(1) Parsing with Derivatives. The algorithm has been formally proven correct in Coq.
- JSON: This example showcases how to build a basic JSON parser using Scallion.
- Lambda Calculus: This example shows how to get a pretty printer almost for free alongside your parser.
- Calculator: This example shows how to use the
operators
combinator to easily handle operators with various associativities and priorities. - Roman Numerals: This example presents a simple parser and pretty printer for roman numerals.