Correct-by-construction pretty-printing

DTP '13 Pub Date : 2013-09-24 DOI:10.1145/2502409.2502410
Nils Anders Danielsson
{"title":"Correct-by-construction pretty-printing","authors":"Nils Anders Danielsson","doi":"10.1145/2502409.2502410","DOIUrl":null,"url":null,"abstract":"A new approach to correct-by-construction pretty-printing is presented. The basic methodology is the one of classical (not necessarily correct) pretty-printing: users convert values to pretty-printer documents, and a general rendering algorithm turns documents into strings. The main novelty is that dependent types are used to ensure that, for each value, the constructed document is correct with respect to the value and a given grammar. Other parts of the development use well-established technology: the pretty-printer document interface is basically that of Wadler (2003), but with more precise types, and a single additional primitive combinator; and Wadler's rendering algorithm is used.\n It is proved that if a given value is pretty-printed, and the resulting string parsed (with respect to the same, unambiguous grammar), then the original value is obtained. No guarantees are made about \"prettiness\".","PeriodicalId":205623,"journal":{"name":"DTP '13","volume":"56 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2013-09-24","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"9","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"DTP '13","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2502409.2502410","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 9

Abstract

A new approach to correct-by-construction pretty-printing is presented. The basic methodology is the one of classical (not necessarily correct) pretty-printing: users convert values to pretty-printer documents, and a general rendering algorithm turns documents into strings. The main novelty is that dependent types are used to ensure that, for each value, the constructed document is correct with respect to the value and a given grammar. Other parts of the development use well-established technology: the pretty-printer document interface is basically that of Wadler (2003), but with more precise types, and a single additional primitive combinator; and Wadler's rendering algorithm is used. It is proved that if a given value is pretty-printed, and the resulting string parsed (with respect to the same, unambiguous grammar), then the original value is obtained. No guarantees are made about "prettiness".
Correct-by-construction精细打印
提出了一种结构校正的美观打印新方法。基本的方法是经典的(不一定是正确的)漂亮打印:用户将值转换为漂亮的打印文档,通用呈现算法将文档转换为字符串。主要的新颖之处在于,使用依赖类型来确保对于每个值,构建的文档相对于该值和给定语法是正确的。开发的其他部分使用了成熟的技术:漂亮的打印机文档接口基本上是Wadler(2003)的,但具有更精确的类型和单个额外的原语组合子;采用Wadler的绘制算法。可以证明,如果给定的值打印得很好,并且解析了结果字符串(根据相同的、明确的语法),那么就可以获得原始值。没有人能保证“漂亮”。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
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学术文献互助群
群 号:604180095
Book学术官方微信