JSON Parser

2beaucoup edited this page Sep 21, 2012 · 6 revisions
Clone this wiki locally

The JSON Parser example lives in the org.parboiled.examples.json package and shows a complete JSON Parser built with parboiled for Scala.
It builds an AST representation of the parsed JSON source and exercises many of parboileds features. As such it is a very good starting point for your own parboiled for Scala project.

The three contained Scala classes contain the following parser versions:

Class Parser
JsonParser0 Basic recognizer grammar without any actions
JsonParser1 Full JSON parser with actions building an AST
JsonParser2 Same as JsonParser1 but with most types being made explicit (rather than inferred), worth a look if JsonParser1 is unclear