Table of Contents
Fetching ...

SimpliPy: A Source-Tracking Notional Machine for Simplified Python

Moida Praneeth Jain, Venkatesh Choppella

TL;DR

Misconceptions about how programs execute hinder novice learners, particularly around control flow and lexical scoping. SimpliPy proposes a line-tracked, notional machine for a Python subset that combines precise operational semantics with static analyses and a visual debugger to connect code to behavior. It contributes a formal semantics for a subset, a static artefact pipeline including CFGs and lexical scopes, and an interactive visualization tool that animates state and control flow on the corresponding CFG. The work demonstrates how semantics-based pedagogy, supported by paper-and-pencil artifacts and visualization, can improve mental models and offer a concrete demonstration of applying formal methods to program understanding.

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.

SimpliPy: A Source-Tracking Notional Machine for Simplified Python

TL;DR

Misconceptions about how programs execute hinder novice learners, particularly around control flow and lexical scoping. SimpliPy proposes a line-tracked, notional machine for a Python subset that combines precise operational semantics with static analyses and a visual debugger to connect code to behavior. It contributes a formal semantics for a subset, a static artefact pipeline including CFGs and lexical scopes, and an interactive visualization tool that animates state and control flow on the corresponding CFG. The work demonstrates how semantics-based pedagogy, supported by paper-and-pencil artifacts and visualization, can improve mental models and offer a concrete demonstration of applying formal methods to program understanding.

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.
Paper Structure (18 sections, 3 equations, 1 figure, 1 table)

This paper contains 18 sections, 3 equations, 1 figure, 1 table.

Figures (1)

  • Figure 1: The SimpliPy interactive visualization tool interface. Coordinated views display the program state according to the SimpliPy notional machine: (Left) Source code with the current instruction highlighted. (Top Middle) The Environment Scope View visualizes the lexical map ($e$) and hierarchy ($h$) as a tree, showing active environments and their variable bindings. (Bottom Middle) The Continuation Stack ($k$) displays active execution contexts $(location, env\_id)$. (Right) The Control Flow Graph (CFG) highlights the edge representing the most recent control transfer. Debugging controls at the top allow simplifying code, starting/resetting execution, stepping forward/backward, and toggling the CFG view.