arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1608.07261cs.PL
收藏

JavaScript(扩展版)静态编译的类型推断

Type Inference for Static Compilation of JavaScript (Extended Version)

Satish Chandra, Colin S. Gordon, Jean-Baptiste Jeannin, Cole Schlesinger, Manu Sridharan, Frank Tip, Youngil Choi

摘要:

我们提出了一个类型系统和推理算法的丰富子集的JavaScript配备对象,结构子类型,原型继承,和一流的方法。该类型系统支持抽象和递归对象,并且具有足够的表达能力,可以容纳几个标准基准测试,而只需要一些较小的变通方法。由类型强制执行的不变量使提前编译器能够执行动态语言的静态编译器通常无法达到的优化。与以前的推理技术原型继承,我们的算法使用了一个组合的下限和上限传播推断类型和发现类型错误的所有代码,包括未调用的功能。推理表示在一个简单的约束语言,旨在利用现成的固定点求解器。我们证明了类型系统和推理算法的合理性。实验评估表明,推理是强大的,处理上述基准没有手动类型注释,并推断类型实现有效的静态编译。

英文摘要:

We present a type system and inference algorithm for a rich subset of JavaScript equipped with objects, structural subtyping, prototype inheritance, and first-class methods. The type system supports abstract and recursive objects, and is expressive enough to accommodate several standard benchmarks with only minor workarounds. The invariants enforced by the types enable an ahead-of-time compiler to carry out optimizations typically beyond the reach of static compilers for dynamic languages. Unlike previous inference techniques for prototype inheritance, our algorithm uses a combination of lower and upper bound propagation to infer types and discover type errors in all code, including uninvoked functions. The inference is expressed in a simple constraint language, designed to leverage off-the-shelf fixed point solvers. We prove soundness for both the type system and inference algorithm. An experimental evaluation showed that the inference is powerful, handling the aforementioned benchmarks with no manual type annotation, and that the inferred types enable effective static compilation.

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

↑