🤖 AI Summary
Novice programmers often struggle due to misconceptions about Python’s control flow and scoping mechanisms. To address this, we propose a pedagogical tool integrating formal operational semantics with static program analysis. Our approach explicitly annotates operational semantics with source line numbers, enabling precise step-to-location mapping during execution; it further combines statically generated control-flow graphs with lexical scoping analysis to dynamically visualize runtime environments, call stacks, and control transfers. Implemented as an interactive, web-based debugger, the tool supports real-time exploration of program behavior. Its key innovation lies in the first unified integration of line-number-annotated operational semantics, static structural analysis, and pedagogically grounded visualization—thereby significantly enhancing beginners’ comprehension of dynamic program behavior and their efficiency in tracing execution.
📝 Abstract
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.