Wasm SpecTec:工程化形式语言标准
Wasm SpecTec: Engineering a Formal Language Standard
AI总结:
Wasm SpecTec 通过领域特定语言自动生成并检查 WebAssembly 形式规范及相关产物,减轻规范编写负担,推动标准化流程自动化。
摘要:
WebAssembly(Wasm)是一种低级字节码语言和虚拟机,旨在作为多种编程语言的编译目标,正被广泛应用于各类生态系统中。作为一项新兴技术,Wasm 持续演进——去年达到了 2.0 版本,预计很快将迎来又一次重大更新。\n\n在 Wasm 中,一个新特性要被标准化,必须提交四项关键产物:该特性的形式化(数学)规范、配套的散文式伪代码描述、官方参考解释器中的实现,以及一套单元测试。这一严谨流程有助于避免新 Wasm 特性在设计和实现中的错误,尤其是 Wasm 独特的形式化规范,已促进了针对该语言各种正确性属性的机器验证证明。然而,手工制作所有这些产物需要专业知识,同时伴随着重复且繁琐的劳动,这给语言的标准化过程和规范编写带来了负担。\n\n本文介绍了 Wasm SpecTec,一种通过领域特定语言(DSL)来表达 Wasm 形式化规范的技术。该 DSL 允许对 Wasm 目前所有手写的规范产物进行错误检查,并从单一事实来源自动生成,且设计上易于编写、阅读、比较和审查。我们相信,Wasm SpecTec 的自动化和元级错误检查将显著减轻当前语言规范编写者的负担。我们通过展示 Wasm SpecTec 在生成各种产物方面的能力,来演示其当前的功能,并描述了我们在用 Wasm SpecTec 生成的规范取代手写官方 Wasm 规范文档方面所做的工作。
英文摘要:
WebAssembly (Wasm) is a low-level bytecode language and virtual machine, intended as a compilation target for a wide range of programming languages, which is seeing increasing adoption across diverse ecosystems. As a young technology, Wasm continues to evolve -- it reached version 2.0 last year and another major update is expected soon. For a new feature to be standardised in Wasm, four key artefacts must be presented: a formal (mathematical) specification of the feature, an accompanying prose pseudocode description, an implementation in the official reference interpreter, and a suite of unit tests. This rigorous process helps to avoid errors in the design and implementation of new Wasm features, and Wasm's distinctive formal specification in particular has facilitated machine-checked proofs of various correctness properties for the language. However, manually crafting all of these artefacts requires expert knowledge combined with repetitive and tedious labor, which is a burden on the language's standardization process and authoring of the specification. This paper presents Wasm SpecTec, a technology to express the formal specification of Wasm through a domain-specific language. This DSL allows all of Wasm's currently handwritten specification artefacts to be error-checked and generated automatically from a single source of truth, and is designed to be easy to write, read, compare, and review. We believe that Wasm SpecTec's automation and meta-level error checking will significantly ease the current burden of the language's specification authors. We demonstrate the current capabilities of Wasm SpecTec by showcasing its proficiency in generating various artefacts, and describe our work towards replacing the manually written official Wasm specification document with specifications generated by Wasm SpecTec.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。