arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.21282cs.CYcs.AIcs.SE
收藏

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

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

Texas Tech University(德克萨斯理工大学);Xavier University of Louisiana(路易斯安那泽维尔大学)

Zhenyu Xu, Kun Zhang, Victor S. Sheng

AI总结:

针对学生编程作业中逻辑错误难定位的问题,提出以伪代码为支撑构建代码-伪代码图、用图神经网络定位并修正错误的方法,还构建了对应数据集,实验显示top-10定位准确率达99.2%。

摘要:

伪代码广泛应用于入门编程课程中,用于指导计算机科学专业学生学习算法设计,它借助自然语言来定义算法行为。这种学习方式让学生能够将伪代码转换为源代码并运行,以验证其算法的正确性。这一过程通常会引入两类错误:语法错误和逻辑错误。语法错误往往会伴随编译器反馈,帮助学生定位出错的代码行。相比之下,逻辑错误更具挑战性,因为它们不会触发编译器报错,也缺乏即时的诊断反馈,因此更难被发现和修正。为应对这一难题,我们开发了一套系统,旨在在行级层面定位学生编程作业中的逻辑错误。我们的方法以伪代码为支撑构建代码-伪代码图,将源代码中的符号与其对应的伪代码符号关联起来。随后,我们采用图神经网络(Graph Neural Network)来定位逻辑错误并给出修正建议。此外,我们设计了一种方法,可在语法错误修正过程中高效收集易出现逻辑错误的程序,并将其整理为一个包含单行和多行逻辑错误的数据集,且标注了错误行的索引。我们的实验结果前景可观,表明在排名前10的可疑代码行中,逻辑错误的定位准确率达到99.2%,凸显了我们的方法在提升学生编程能力与纠错技能方面的有效性。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑