Skip to main content
QUICK REVIEW

[Paper Review] Generation of Pseudo Code from the Python Source Code using Rule-Based Machine Translation

Sawan Rai, Atul Gupta|arXiv (Cornell University)|Jun 14, 2019
Software Engineering ResearchComputer Science7 references6 citations
TL;DR

This paper proposes a rule-based machine translation approach to automatically generate pseudo code from Python source code. By converting Python code into XML for structured information extraction and applying predefined pseudo code templates, the method enables efficient, scalable generation of human-readable pseudo code, offering a solution to the labor-intensive manual creation of such artifacts.

ABSTRACT

Pseudo code is one of the valuable artifacts to comprehending the complex program codes. Most of the source code still has no equivalent pseudo code, due to the time-consuming process of writing pseudo codes. In this work, we have developed an approach to generate pseudo code from the python source code. In the first step, we convert python code into XML code for better code information extraction. Next, Important information extracted from the XML code, which later on used to generate actual pseudo code with the help of pseudo code templates. Initial performance results have been discussed in this paper.

Motivation & Objective

  • To address the lack of available pseudo code for most existing Python source code due to the time-consuming manual process.
  • To develop an automated method that transforms Python code into equivalent, human-readable pseudo code.
  • To improve program comprehension by generating standardized pseudo code that preserves logical structure and control flow.
  • To evaluate the feasibility and initial performance of a rule-based approach for pseudo code generation.

Proposed method

  • Convert input Python source code into XML format to enable structured parsing and information extraction.
  • Extract key program elements such as variables, control structures, and function definitions from the XML representation.
  • Map extracted syntactic and semantic elements to predefined pseudo code templates using rule-based mapping logic.
  • Generate final pseudo code by substituting template placeholders with extracted code elements in a human-readable format.
  • Use a set of hand-crafted rules and templates to ensure consistency and readability in the output pseudo code.

Experimental results

Research questions

  • RQ1Can a rule-based system effectively translate Python source code into equivalent pseudo code?
  • RQ2How accurately can the generated pseudo code preserve the logical structure and control flow of the original Python code?
  • RQ3What is the performance of the proposed method in terms of scalability and maintainability?
  • RQ4To what extent does the XML-based parsing improve information extraction for pseudo code generation?

Key findings

  • The proposed method successfully transforms Python code into readable pseudo code using XML-based parsing and rule-based template mapping.
  • The approach reduces the manual effort required to generate pseudo code by automating the translation process.
  • Initial performance results indicate that the method is feasible and produces semantically accurate pseudo code for basic to intermediate control structures.
  • The use of XML enables structured extraction of code elements, improving parsing reliability compared to direct string processing.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.