Abstract

The rate of software development has increased dramatically. Conventional compilers cannot assess and detect all source code errors. Software may thus contain errors, negatively affecting end-users. It is also difficult to assess and detect source code logic errors using traditional compilers, resulting in software that contains errors. A method that utilizes artificial intelligence for assessing and detecting errors and classifying source code as correct (error-free) or incorrect is thus required. Here, we propose a sequential language model that uses an attention-mechanism-based long short-term memory (LSTM) neural network to assess and classify source code based on the estimated error probability. The attentive mechanism enhances the accuracy of the proposed language model for error assessment and classification. We trained the proposed model using correct source code and then evaluated its performance. The experimental results show that the proposed model has logic and syntax error detection accuracies of 92.2% and 94.8%, respectively, outperforming state-of-the-art models. We also applied the proposed model to the classification of source code with logic and syntax errors. The average precision, recall, and F-measure values for such classification are much better than those of benchmark models. To strengthen the proposed model, we combined the attention mechanism with LSTM to enhance the results of error assessment and detection as well as source code classification. Finally, our proposed model can be effective in programming education and software engineering by improving code writing, debugging, error-correction, and reasoning.

Highlights

  • A huge amount of software is written in educational institutions and industry, making software reliability increasingly important

  • We present a language model for assessing and detecting various source code errors as well as classifying the source code as correct or incorrect based on the estimated error probability

  • : We developed a general model that can be trained on any type of problem set

Read more

Summary

Introduction

A huge amount of software is written in educational institutions and industry, making software reliability increasingly important. A single error is often enough to cause software failure It is sometimes difficult for student or professional programmers to identify logic errors in source code, even with the help of traditional compilers. Especially novice programmers, properly assess and classify source code errors has become an important research topic in software engineering and programming education [1,2]. Student and professional programmers spend a huge amount of time trying to find source code errors. The LSTM based language model is a promising method for source code error assessment and classification. AI-based language models are often used for source code assessment and classification to obtain human-like responses. Many researchers have used AI-based models to detect source code errors in software engineering and programming education

Objectives
Methods
Results
Discussion
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call