函数式语言可证明正确的编译成脚本语言

P. Giannini, A. Shaqiri
{"title":"函数式语言可证明正确的编译成脚本语言","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":"{\"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}","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

摘要

在本文中,我们考虑将核心f#(一种包含可变变量的类型化函数式语言)转换为脚本语言(如JavaScript或Python)的问题。在之前的工作中,我们用一种中间语言(简称IL)抽象了脚本语言的最重要特征,这种中间语言是一种命令式语言,其名称(变量和函数)的定义是在块中完成的,并且名称的定义不必静态地先于其使用。我们为核心f#和IL定义了一个大步操作语义,并形式化了f#表达式到IL的翻译。本文的主要贡献是证明了给定翻译的正确性,这是通过证明一个类型良好的f#程序的求值收敛于一个原始值当且仅当其转换为IL的求值收敛于相同的值来完成的。对于这个证明来说,核心f#的类型稳健性是至关重要的,它是通过给出散度谓词的协归纳形式化来证明的,并且证明了良好类型的表达式要么收敛于一个值,要么发散,因此它们永远不会卡住。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
A Provably Correct Compilation of Functional Languages into Scripting Languages
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.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
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学术官方微信