谷歌浏览器插件
订阅小程序
在清言上使用

A Stepper for a Functional JavaScript Sublanguage

Martin Henz, Thomas Tan, Zachary Chua,Peter Jung, Yee-Jian Tan, Xinyi Zhang, Jingjing Zhao

Proceedings of the 2021 ACM SIGPLAN International Symposium on SPLASH-E(2021)

引用 4|浏览28
暂无评分
摘要
The first two chapters of the introductory computer science textbook Structure and Interpretation of Computer Programs, JavaScript Adaptation (SICP JS), use a subset of JavaScript called Source §2. The book introduces the reduction-based “substitution model” as a first mental model for the evaluation of Source §2 programs. To support the learner in adopting this mental model, we built an algebraic stepper—a tool for visualizing the evaluation of Source §2 programs according to the model. As a sublanguage of JavaScript, Source §2 differs from other purely functional programming languages by using a statement-oriented syntax, with statement sequences, return statements, and block-scoped declarations. For the purpose of this tool description, we distill these distinguishing features—along with explicit recursion—into a Source §2 sublanguage that we call Source §0, and focus on a stepper for this language. We formalize the substitution model of Source §0 as a lambda-calculus-style reduction semantics that handles explicit recursion by term graph rewriting and faithfully implements the JavaScript specification, when restricted to that language. Our implementation of the stepper represents term graphs by persistent data structures that maximize sharing and enable random access to all steps. This work presents the first reduction-based semantics for a JavaScript sublanguage and the first algebraic stepper for a language with return statements and block-scoped declarations. The tool supports the learner with step-level explanations, redex highlighting, and function-level skipping and can also be used for teaching the applicative-order-reduction lambda calculus.
更多
查看译文
关键词
Source Code Analysis,Programming Language Semantics,Type Inference
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要