SimpliPy:一种用于 Simplified Python 的源代码跟踪概念机
SimpliPy: A Source-Tracking Notional Machine for Simplified Python
AI总结:
本文提出面向 Python 子集的源代码跟踪概念机 SimpliPy,通过带行号的操作语义、CFG 与词法作用域静态分析及交互式调试可视化,帮助新手理解程序执行。
摘要:
对程序执行的误解阻碍了许多新手程序员。我们介绍 SimpliPy,这是一种围绕精心选择的 Python 子集设计的概念机,用于阐明核心控制流和作用域概念。它的基础是精确的操作语义,该语义为每个执行步骤显式跟踪源代码行号,使代码与行为之间的联系明确无误。作为动态语义的补充,SimpliPy 使用静态分析生成控制流图(CFG)并识别词法作用域,帮助学生在跟踪执行之前建立结构化理解。我们还展示了一个基于这些原则构建的交互式 Web 调试器。该工具体现了这些形式化技术,将操作状态(环境、栈)可视化,并在逐步执行期间使用静态 CFG 直接在图上动画展示控制流。因此,SimpliPy 整合了形式语义、程序分析和可视化,既提供了一种教学方法,也提供了将形式方法应用于程序理解的实际演示。
英文摘要:
Misconceptions about program execution hinder many novice programmers. We introduce SimpliPy, a notional machine designed around a carefully chosen Python subset to clarify core control flow and scoping concepts. Its foundation is a precise operational semantics that explicitly tracks source code line numbers for each execution step, making the link between code and behavior unambiguous. Complementing the dynamic semantics, SimpliPy uses static analysis to generate Control Flow Graphs (CFGs) and identify lexical scopes, helping students build a structural understanding before tracing. We also present an interactive web-based debugger built on these principles. This tool embodies the formal techniques, visualizing the operational state (environments, stack) and using the static CFG to animate control flow directly on the graph during step-by-step execution. SimpliPy thus integrates formal semantics, program analysis, and visualization to offer both a pedagogical approach and a practical demonstration of applying formal methods to program understanding.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。