Scala的sbt-rats解析器生成器插件(工具论文)

A. Sloane, F. Cassez, Scott Buckley
{"title":"Scala的sbt-rats解析器生成器插件(工具论文)","authors":"A. Sloane, F. Cassez, Scott Buckley","doi":"10.1145/2998392.3001580","DOIUrl":null,"url":null,"abstract":"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 Scala-focused parser generation that is embodied in our sbtrats plugin for the Scala Build Tool. At its simplest, sbtrats 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, sbtrats can optionally generate case class definitions for the tree structure and a pretty-printer defined using our Kiama language processing library. We explain the sbtrats 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.","PeriodicalId":269542,"journal":{"name":"Proceedings of the 2016 7th ACM SIGPLAN Symposium on Scala","volume":"2012 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2016-10-30","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"3","resultStr":"{\"title\":\"The sbt-rats parser generator plugin for Scala (tool paper)\",\"authors\":\"A. Sloane, F. Cassez, Scott Buckley\",\"doi\":\"10.1145/2998392.3001580\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"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 Scala-focused parser generation that is embodied in our sbtrats plugin for the Scala Build Tool. At its simplest, sbtrats 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, sbtrats can optionally generate case class definitions for the tree structure and a pretty-printer defined using our Kiama language processing library. We explain the sbtrats 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.\",\"PeriodicalId\":269542,\"journal\":{\"name\":\"Proceedings of the 2016 7th ACM SIGPLAN Symposium on Scala\",\"volume\":\"2012 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2016-10-30\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"3\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Proceedings of the 2016 7th ACM SIGPLAN Symposium on Scala\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/2998392.3001580\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 2016 7th ACM SIGPLAN Symposium on Scala","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2998392.3001580","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 3

摘要

创建解析器的工具是成熟语言生态系统的关键部分。Scala传统上依赖于组合子库来定义解析器,但作为库,它们具有基本的实现限制。另一种选择是使用基于java的解析器生成器,如ANTLR或Rats!但是这些工具非常冗长,不适合用于Scala代码。我们描述了我们在Scala构建工具的sbtrats插件中使用以Scala为中心的解析器生成的经验。简单地说,sbtrats提供了与Rats的桥梁!用于Java的解析器生成器。在这个桥的顶部,我们有一个简单的语法定义符号,它包含了用于树构造和漂亮打印的注释。以及生成一个老鼠!语法,sbtrats可以选择性地为树结构和使用Kiama语言处理库定义的漂亮打印机生成大小写类定义。我们解释了sbtrats语法表示法,并描述了我们使用它定义LLVM汇编表示法的语法和SMTLIB输入/输出语言的SMT求解器的积极经验。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
The sbt-rats parser generator plugin for Scala (tool paper)
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 Scala-focused parser generation that is embodied in our sbtrats plugin for the Scala Build Tool. At its simplest, sbtrats 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, sbtrats can optionally generate case class definitions for the tree structure and a pretty-printer defined using our Kiama language processing library. We explain the sbtrats 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.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信