JavaScript Language Design and Implementation in Tandem

Sukyoung Ryu,Jihyeok Park
DOI: https://doi.org/10.1145/3624723
IF: 22.7
2024-05-02
Communications of the ACM
Abstract:A proposal to first design a language in a mechanized specification, and the advantages that follow.
computer science, theory & methods, software engineering, hardware & architecture
What problem does this paper attempt to address?
The paper primarily explores how to automatically extract formal (or "mechanized") specifications from programming language specifications written in natural language and demonstrates the practical value of this approach. Specifically, the paper addresses the following key issues: 1. **Specification Consistency and Implementation Correctness**: Existing programming language specifications often contain imprecise, erroneous, or ambiguous statements, leading to discrepancies between different implementations and even behaviors that do not conform to the specification. 2. **The Special Case of JavaScript**: As a widely used programming language, JavaScript's specification is particularly complex and constantly evolving, making it a challenge to maintain specification consistency and ensure interoperability between different browser engines. 3. **Automated Tool Support**: To address the above challenges, the authors propose a method to extract machine-readable formal specifications from natural language descriptions. Based on this formal specification, various tools can be automatically generated, including type checkers, test case generators, static analyzers, etc. Using this method, researchers can detect issues within the specification itself as well as inconsistencies between the specification and existing implementations. For example, the paper mentions a type-related error in the `Math.round` function specification. Additionally, this method can help detect and locate bugs in JavaScript engines. In summary, the main contribution of this paper is the proposal of a new programming language development process: first design the language in a formal specification, then generate multiple human-friendly natural language specifications and construct correct implementations and tools from it. This approach can significantly improve the quality of specifications and the accuracy of implementations, especially in rapidly evolving languages like JavaScript.