journal article·2022Open access

DLBT: Deep Learning-Based Transformer to Generate Pseudo-Code from Source Code

Walaa Gad, Anas Alokla, Waleed Nazih, Mustafa Aref, Abdel-badeeh Salem

Computers, Materials & Continua· Volume 70· Issue 2

Abstract

Understanding the content of the source code and its regular expression is very difficult when they are written in an unfamiliar language. Pseudo-code explains and describes the content of the code without using syntax or programming language technologies. However, writing Pseudo-code to each code instruction is laborious. Recently, neural machine translation is used to generate textual descriptions for the source code. In this paper, a novel deep learning-based transformer (DLBT) model is proposed for automatic Pseudo-code generation from the source code. The proposed model uses deep learning which is based on Neural Machine Translation (NMT) to work as a language translator. The DLBT is based on the transformer which is an encoder-decoder structure. There are three major components: tokenizer and embeddings, transformer, and post-processing. Each code line is tokenized to dense vector. Then transformer captures the relatedness between the source code and the matching Pseudo-code without the need of Recurrent Neural Network (RNN). At the post-processing step, the generated Pseudo-code is optimized. The proposed model is assessed using a real Python dataset, which contains more than 18,800 lines of a source code written in Python. The experiments show promising performance results compared with other machine translation methods such as Recurrent Neural Network (RNN). The proposed DLBT records 47.32, 68. 49 accuracy and BLEU performance measures, respectively.
Source: openalex_inverted_index · Quality: baseline

Research context

OpenAlex topics: Natural Language Processing Techniques · Software Engineering Research · Topic Modeling

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

References (27)

Show source-provided references
1. Source code comprehension analysis in software maintenance
2. Generating pseudo-code from source code using deep learning
3. Learning to generate pseudo-code from source code using statistical machine translation
4. The survey: Text generation models in deep learning
5. A new approach for the vanishing gradient problem on sigmoid activation10.1007/s13748-020-00218-y ↗
6. Long short-term memory10.1162/neco.1997.9.8.1735 ↗
7. LSTM neural networks for language modeling
8. Quantifying the vanishing gradient and long-distance dependency problem in recursive neural networks and recursive LSTMs
9. Attention is all you need
10. A structured review of the validity of BLEU10.1162/coli_a_00322 ↗
11. Neural machine translation by jointly learning to align and translate
12. Learning-based recursive aggregation of abstract syntax trees for code clone detection
13. From code to natural language: Type-aware sketch-based seq2seq learning
14. Incorporating copying mechanism in sequence-to-sequence learning
15. A syntactic neural model for general-purpose code generation
16. Retrieval-based neural code generation
17. Guiding neural machine translation with retrieved translation pieces
18. Convolutional neural networks over tree structures for programming language processing
19. Deep code comment generation
20. Deep code comment generation with hybrid lexical and syntactical10.1007/s10664-019-09730-9 ↗
21. Towards context-aware code comment generation
22. Learning phrase representations using RNN encoder-decoder for statistical machine translation
23. Graph attention networks
24. Generation of Pseudo code from the Python source code using rule-based machine translation
25. Pytorch: An imperative style, high-performance deep learning library
26. Industrial-Strength Natural Language Processing
27. WordNet, A Lexical Database · 2021