arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.22684cs.PL
收藏

用证据编译渐进类型

Compiling Gradual Types with Evidence

University of Chile(智利大学)

José Luis Romero, Cristóbal Isla, Matías Toro, Éric Tanter

AI总结:

本文提出GrEv编译器,基于证据实现高效渐进类型化,实验显示其性能优于基于转换的编译器。

摘要:

高效地在具有结构类型的语言中支持声音的渐进类型化是一个挑战。截至目前,Grift编译器是唯一接近底层实现渐进类型化的实现,利用转换来执行运行时检查,并进一步扩展了单调引用以高效访问静态类型数据结构。在语言设计和语义学方面,抽象渐进类型(AGT)方法学已被证明有助于阐明现有设计,并通过推导各种类型纪律和语言特征的渐进化来创新。基于抽象解释,AGT的Curry-Howard启发的运行时语义是基于一致性判断的证据,这些判断在减少过程中演变,监控着类型正确性的合理性。虽然表达力强且灵活,但不清楚这种基于证据的语义是否是实现高效渐进类型化的可行途径。在本工作中,我们通过设计、实现和评估一个基于证据的编译器,称为GrEv,来探讨这个问题。我们解释了如何弥合形式语义与GrEv编译器实现之间的差距,并识别了新的单调语义。我们对Grift基准套件评估了GrEv的性能。结果表明,基于证据的编译器可以与,甚至比基于转换的编译器更高效,在静态到动态的谱系上表现出更稳定的性能。除了丰富渐进类型编译器的领域外,这项工作还为探索文献中通过AGT正式推导的许多高级渐进类型纪律的高效实现打开了直接通道。

英文摘要:

Efficiently supporting sound gradual typing in a language with structural types is challenging. To date, the Grift compiler is the only close-to-the-metal implementation of gradual typing in this setting, exploiting coercions for runtime checks, and further extended with monotonic references for efficient access to statically-typed data structures. On the language design and semantics side, the Abstracting Gradual Typing (AGT) methodology has proven fruitful to elucidate existing designs and to innovate by deriving gradualizations of a wide variety of typing disciplines and language features. Grounded in abstract interpretation, the Curry-Howard inspired runtime semantics of AGT is based on the notion of evidence for consistent judgments that evolve during reduction, monitoring the plausibility of well-typedness. While expressive and versatile, it is unclear whether such evidence-based semantics are a viable route to realize an efficient implementation of gradual typing. In this work, we explore this question by designing, implementing, and evaluating an evidence-based compiler, called GrEv. We explain how to bridge the gap between the formal semantics and the GrEv compiler implementation, and identify novel monotonic semantics. We empirically evaluate the performance of GrEv on the Grift benchmark suite. The results show that an evidence-based compiler can be competitive with, and even faster than, a coercion-based compiler, exhibiting more stability across configurations on the static-to-dynamic spectrum. In addition to enriching the space of gradual typing compilers, this work opens a direct door to exploring efficient implementations of the many advanced gradual typing disciplines formally derived with AGT in the literature.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑