Developing a monadic type checker for an object-oriented language: an experience report

Elias Castegren, Kiko Fernandez-Reyes
{"title":"Developing a monadic type checker for an object-oriented language: an experience report","authors":"Elias Castegren, Kiko Fernandez-Reyes","doi":"10.1145/3357766.3359545","DOIUrl":null,"url":null,"abstract":"Functional programming languages are well-suited for developing compilers, and compilers for functional languages are often themselves written in a functional language. Functional abstractions, such as monads, allow abstracting away some of the repetitive structure of a compiler, removing boilerplate code and making extensions simpler. Even so, functional languages are rarely used to implement compilers for languages of other paradigms. This paper reports on the experience of a four-year long project where we developed a compiler for a concurrent, object-oriented language using the functional language Haskell. The focus of the paper is the implementation of the type checker, but the design works well in static analysis tools, such as tracking uniqueness of variables to ensure data-race freedom. The paper starts from a simple type checker to which we add more complex features, such as type state, with minimal changes to the overall initial design.","PeriodicalId":354325,"journal":{"name":"Proceedings of the 12th ACM SIGPLAN International Conference on Software Language Engineering","volume":"190 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2019-10-20","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"1","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 12th ACM SIGPLAN International Conference on Software Language Engineering","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3357766.3359545","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 1

Abstract

Functional programming languages are well-suited for developing compilers, and compilers for functional languages are often themselves written in a functional language. Functional abstractions, such as monads, allow abstracting away some of the repetitive structure of a compiler, removing boilerplate code and making extensions simpler. Even so, functional languages are rarely used to implement compilers for languages of other paradigms. This paper reports on the experience of a four-year long project where we developed a compiler for a concurrent, object-oriented language using the functional language Haskell. The focus of the paper is the implementation of the type checker, but the design works well in static analysis tools, such as tracking uniqueness of variables to ensure data-race freedom. The paper starts from a simple type checker to which we add more complex features, such as type state, with minimal changes to the overall initial design.
为面向对象语言开发一元类型检查器:经验报告
函数式编程语言非常适合开发编译器,而函数式语言的编译器本身通常是用函数式语言编写的。函数抽象(例如monad)允许抽象掉编译器的一些重复结构,删除样板代码并简化扩展。即便如此,函数式语言很少用于实现其他范式语言的编译器。本文报告了一个长达四年的项目的经验,在这个项目中,我们使用函数式语言Haskell为一种并发的、面向对象的语言开发了一个编译器。本文的重点是类型检查器的实现,但该设计在静态分析工具中工作得很好,例如跟踪变量的唯一性以确保数据竞争自由。本文从一个简单的类型检查器开始,我们添加了更复杂的功能,如类型状态,对总体初始设计的更改最小。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术官方微信