The sbt-rats parser generator plugin for scala (tool paper)

Anthony M. Sloane, Franck Cassez, Scott Buckley

Research output: Chapter in Book/Report/Conference proceedingConference proceeding contributionpeer-review

3 Citations (Scopus)


Tools for creating parsers are a key part of a mature language eco-system. Scala has traditionally relied on combinator libraries for defining parsers but being libraries they come with fundamental implementation limitations. An alternative is to use a Java-based parser generator such as ANTLR or Rats! but these tools are quite verbose and not ideal to use with Scala code. We describe our experiences with Scalafocused parser generation that is embodied in our sbt-rats plugin for the Scala Build Tool. At its simplest, sbt-rats provides a bridge to the Rats! parser generator for Java. On top of this bridge, we have a simple grammar definition notation that incorporates annotations for tree construction and pretty-printing. As well as generating a Rats! grammar, sbt-rats can optionally generate case class definitions for the tree structure and a pretty-printer defined using our Kiama language processing library. We explain the sbt-rats grammar notation and describe our positive experiences using it to define grammars for LLVM assembly notation and the SMTLIB input/output language for SMT solvers.

Original languageEnglish
Title of host publicationSCALA 2016 - Proceedings of the 2016 7th ACM SIGPLAN Symposium on Scala
EditorsAggelos Biboudis, Manohar Jonnalagedda, Sandro Stucki, Vlad Ureche
Place of PublicationNew York
PublisherAssociation for Computing Machinery, Inc
Number of pages4
ISBN (Electronic)9781450346481
Publication statusPublished - 30 Oct 2016
Event7th ACM SIGPLAN Symposium on Scala, SCALA 2016 - Amsterdam, Netherlands
Duration: 30 Oct 201631 Oct 2016


Other7th ACM SIGPLAN Symposium on Scala, SCALA 2016


  • Parsing expression grammars
  • Scala build tool


Dive into the research topics of 'The sbt-rats parser generator plugin for scala (tool paper)'. Together they form a unique fingerprint.

Cite this