摘要
为了提高程序题自动评分的准确性,及解决传统评分方法无法从语法结构和语义角度衡量错误的学生程序与正确答案之间的相似度,提出了一种基于抽象语法树匹配的程序题自动评分方法。文中以JavaCC技术为核心,首先通过词法分析、语法分析和语义分析生成错误列表和抽象语法树的中间表示,然后通过语法树切片匹配得分,最后和错误列表结合给出评分结果。文中详细论述了各个模块的设计方法,着重讨论了抽象语法树生成并匹配的细节,设计并实现了一个传统方法与语义分析结合的C++程序题自动评分系统。通过对实际考试的结果进行实验,进而验证了该系统的实用性与有效性。
A system for grading student programs is designed to enhance the accuracy, and solve the problem that traditional automatic grading approaches can not evaluate the similarity of the source code to correct solutions by using syntax structure and semantic analysis. Present a tool for quickly comparing the source code of student programs and correct solutions. The approach is based on partial abstract syntax tree matching (AST) ,and using JavaCC to generate the AST,then making the score by Tree Cuts and combine the parse error. In this paper, designed and implemented a grading system on C++ programs, and the semantic analysis is used in conjunction with traditional approaches. And then, verify the practicability and effectiveness of the system.
出处
《计算机技术与发展》
2012年第1期126-128,共3页
Computer Technology and Development