arXiv:2410.21282cs.CYcs.AI2024-10被引 1

用伪代码图神经网络定位学生编程作业中的逻辑错误

Logic Error Localization in Student Programming Assignments Using Pseudocode and Graph Neural Networks

  • 构建代码-伪代码关联图,用图神经网络分析错误
  • 在前10行中定位逻辑错误准确率达99.2%
  • 适合教育科技与自动纠错系统开发者参考

伪代码广泛用于计算机科学入门课程,帮助学生通过自然语言设计算法并转换为源代码执行验证。该过程常引入语法错误和逻辑错误。语法错误可通过编译器反馈快速定位,而逻辑错误不触发编译错误,缺乏即时诊断,难以发现与修正。为此,我们开发了一种系统,旨在以行为单位精准定位学生编程作业中的逻辑错误。方法基于伪代码构建代码-伪代码图,将源代码符号与伪代码对应项连接,并利用图神经网络实现错误定位与修正建议。此外,我们设计了高效采集机制,在修复语法错误过程中收集易出逻辑错误的程序,构建包含单行与多行逻辑错误的数据集,附带错误行索引。实验结果表明,该方法在前10个可疑行中对逻辑错误的定位准确率达到99.2%,显著提升学生编码能力与纠错效率。

原文摘要 · Abstract (English)

Pseudocode is extensively used in introductory programming courses to instruct computer science students in algorithm design, utilizing natural language to define algorithmic behaviors. This learning approach enables students to convert pseudocode into source code and execute it to verify their algorithms' correctness. This process typically introduces two types of errors: syntax errors and logic errors. Syntax errors are often accompanied by compiler feedback, which helps students identify incorrect lines. In contrast, logic errors are more challenging because they do not trigger compiler errors and lack immediate diagnostic feedback, making them harder to detect and correct. To address this challenge, we developed a system designed to localize logic errors within student programming assignments at the line level. Our approach utilizes pseudocode as a scaffold to build a code-pseudocode graph, connecting symbols from the source code to their pseudocode counterparts. We then employ a graph neural network to both localize and suggest corrections for logic errors. Additionally, we have devised a method to efficiently gather logic-error-prone programs during the syntax error correction process and compile these into a dataset that includes single and multiple line logic errors, complete with indices of the erroneous lines. Our experimental results are promising, demonstrating a localization accuracy of 99.2% for logic errors within the top-10 suspected lines, highlighting the effectiveness of our approach in enhancing students' coding proficiency and error correction skills.

逻辑错误图神经网络编程教育伪代码

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。