使用范围图定义名称的可访问性(扩展版)

Aron Zwaan, Casper Bach Poulsen
{"title":"使用范围图定义名称的可访问性(扩展版)","authors":"Aron Zwaan, Casper Bach Poulsen","doi":"arxiv-2407.09320","DOIUrl":null,"url":null,"abstract":"Many programming languages allow programmers to regulate accessibility; i.e.,\nannotating a declaration with keywords such as export and private to indicate\nwhere it can be accessed. Despite the importance of name accessibility for,\ne.g., compilers, editor auto-completion and tooling, and automated\nrefactorings, few existing type systems provide a formal account of name\naccessibility. We present a declarative, executable, and language-parametric model for name\naccessibility, which provides a formal specification of name accessibility in\nJava, C#, C++, Rust, and Eiffel. We achieve this by defining name accessibility\nas a predicate on resolution paths through scope graphs. Since scope graphs are\na language-independent model of name resolution, our model provides a uniform\napproach to defining different accessibility policies for different languages. Our model is implemented in Statix, a logic language for executable type\nsystem specification using scope graphs. We evaluate its correctness on a test\nsuite that compares it with the C#, Java, and Rust compilers, and show we can\nsynthesize access modifiers in programs with holes accurately.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"2024-07-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Defining Name Accessibility using Scope Graphs (Extended Edition)\",\"authors\":\"Aron Zwaan, Casper Bach Poulsen\",\"doi\":\"arxiv-2407.09320\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Many programming languages allow programmers to regulate accessibility; i.e.,\\nannotating a declaration with keywords such as export and private to indicate\\nwhere it can be accessed. Despite the importance of name accessibility for,\\ne.g., compilers, editor auto-completion and tooling, and automated\\nrefactorings, few existing type systems provide a formal account of name\\naccessibility. We present a declarative, executable, and language-parametric model for name\\naccessibility, which provides a formal specification of name accessibility in\\nJava, C#, C++, Rust, and Eiffel. We achieve this by defining name accessibility\\nas a predicate on resolution paths through scope graphs. Since scope graphs are\\na language-independent model of name resolution, our model provides a uniform\\napproach to defining different accessibility policies for different languages. Our model is implemented in Statix, a logic language for executable type\\nsystem specification using scope graphs. We evaluate its correctness on a test\\nsuite that compares it with the C#, Java, and Rust compilers, and show we can\\nsynthesize access modifiers in programs with holes accurately.\",\"PeriodicalId\":501197,\"journal\":{\"name\":\"arXiv - CS - Programming Languages\",\"volume\":null,\"pages\":null},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-07-12\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - CS - Programming Languages\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2407.09320\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2407.09320","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

许多编程语言都允许程序员规范名称的可访问性,即用关键字(如 export 和 private)对声明进行注释,以指明可以在何处访问该声明。尽管名称的可访问性对于编译器、编辑器自动补全和工具以及自动重构等都很重要,但很少有现有的类型系统能对名称的可访问性做出正式说明。我们提出了一种声明式、可执行和语言参数化的名称可访问性模型,它提供了 Java、C#、C++、Rust 和 Eiffel 中名称可访问性的正式规范。为此,我们将名称可访问性定义为通过作用域图的解析路径的谓词。由于作用域图是一种与语言无关的名称解析模型,因此我们的模型提供了一种统一的方法来为不同语言定义不同的可访问性策略。我们的模型是在 Statix 中实现的,Statix 是一种使用作用域图进行可执行类型系统规范的逻辑语言。我们在一个测试套件中评估了该模型的正确性,并将其与 C#、Java 和 Rust 编译器进行了比较,结果表明我们可以在程序中精确合成带洞的访问修饰符。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Defining Name Accessibility using Scope Graphs (Extended Edition)
Many programming languages allow programmers to regulate accessibility; i.e., annotating a declaration with keywords such as export and private to indicate where it can be accessed. Despite the importance of name accessibility for, e.g., compilers, editor auto-completion and tooling, and automated refactorings, few existing type systems provide a formal account of name accessibility. We present a declarative, executable, and language-parametric model for name accessibility, which provides a formal specification of name accessibility in Java, C#, C++, Rust, and Eiffel. We achieve this by defining name accessibility as a predicate on resolution paths through scope graphs. Since scope graphs are a language-independent model of name resolution, our model provides a uniform approach to defining different accessibility policies for different languages. Our model is implemented in Statix, a logic language for executable type system specification using scope graphs. We evaluate its correctness on a test suite that compares it with the C#, Java, and Rust compilers, and show we can synthesize access modifiers in programs with holes accurately.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
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学术官方微信