A Provably Correct Compilation of Functional Languages into Scripting Languages

P. Giannini, A. Shaqiri
{"title":"A Provably Correct Compilation of Functional Languages into Scripting Languages","authors":"P. Giannini, A. Shaqiri","doi":"10.7561/SACS.2017.1.19","DOIUrl":null,"url":null,"abstract":"In this paper we consider the problem of translating core F#, a typed functional language including mutable variables, into scripting languages such as JavaScript or Python. In previous work, we abstracted the most significant characteristics of scripting languages in an intermediate language (IL for short), which is an imperative language with definition of names (variables and functions) done in blocks and where a definition of a name does not have to statically precede its use. We define a big-step operational semantics for core F# and for IL and formalise the translation of F# expressions into IL. The main contribution of the paper is the proof of correctness of the given translation, which is done by showing that the evaluation of a well-typed F# program converges to a primitive value if and only if the evaluation of its translation into IL converges to the same value. For this proof is crucial the type soundness of core F# which is proved by giving a coinductive formalization of the divergence predicate and proving that well-typed expressions either converge to a value or diverge and so they are never stuck.","PeriodicalId":394919,"journal":{"name":"Sci. Ann. Comput. Sci.","volume":"11 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1900-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Sci. Ann. Comput. Sci.","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.7561/SACS.2017.1.19","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

In this paper we consider the problem of translating core F#, a typed functional language including mutable variables, into scripting languages such as JavaScript or Python. In previous work, we abstracted the most significant characteristics of scripting languages in an intermediate language (IL for short), which is an imperative language with definition of names (variables and functions) done in blocks and where a definition of a name does not have to statically precede its use. We define a big-step operational semantics for core F# and for IL and formalise the translation of F# expressions into IL. The main contribution of the paper is the proof of correctness of the given translation, which is done by showing that the evaluation of a well-typed F# program converges to a primitive value if and only if the evaluation of its translation into IL converges to the same value. For this proof is crucial the type soundness of core F# which is proved by giving a coinductive formalization of the divergence predicate and proving that well-typed expressions either converge to a value or diverge and so they are never stuck.
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
函数式语言可证明正确的编译成脚本语言
在本文中,我们考虑将核心f#(一种包含可变变量的类型化函数式语言)转换为脚本语言(如JavaScript或Python)的问题。在之前的工作中,我们用一种中间语言(简称IL)抽象了脚本语言的最重要特征,这种中间语言是一种命令式语言,其名称(变量和函数)的定义是在块中完成的,并且名称的定义不必静态地先于其使用。我们为核心f#和IL定义了一个大步操作语义,并形式化了f#表达式到IL的翻译。本文的主要贡献是证明了给定翻译的正确性,这是通过证明一个类型良好的f#程序的求值收敛于一个原始值当且仅当其转换为IL的求值收敛于相同的值来完成的。对于这个证明来说,核心f#的类型稳健性是至关重要的,它是通过给出散度谓词的协归纳形式化来证明的,并且证明了良好类型的表达式要么收敛于一个值,要么发散,因此它们永远不会卡住。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Describing weighted safety with weighted LTL over product omega-valuation monoids On Nirmala Indices of Some Hex-derived Networks of Type Three and Their Subdivision Networks Shrinkage Estimators for the Intercept in Linear and Uplift Regression A Teacher of Great Strengths Maximal Existential and Universal Width
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1