Patent Document ID: 9971577
Application ID: 14763795

Base Claim:
1. A method for code conversion, comprising: reading all code lines of a code file to be converted, and recording a total number of lines; creating an original stack of the code lines and a syntax phrase stack according to the total number of lines, and pushing line by line all of the code lines into the original stack of the code lines; popping-up line by line the code lines according to a sequence of the original stack, from the original stack of the code lines; resolving a currently popped-up code line into a phrase to be converted; storing into the syntax phrase stack the phrase to be converted, and popping-up the phrase to be converted according to a sequence of the syntax phrase stack; traversing a preset comparison table of reference phrases and natural languages, wherein if the comparison table has a reference phrase same as the phrase to be converted, then the phrase to be converted is converted into a natural language corresponding to the reference phrase in the comparison table; resolving and converting a next code line when the syntax phrase stack is empty, and ending the conversion when both the original stack of the code lines and the syntax phrase stack are empty; creating a node corresponding to the code line, which the phrase to be converted stored in the syntax phrase stack belongs to, whenever the syntax phrase stack is empty; storing into the node the code line converted through the syntax phrase stack; ending the node creation when both the original stack of the code line and the syntax phrase stack are empty; and forming a code tree using all of the nodes, wherein the creating of a node corresponding to the code line, which the phrase to be converted stored in the syntax phrase stack belongs to, comprises: creating an initialization node, before reading all of the code lines in the code file to be converted; creating one child node defined as child node N in the initialization node if the popped-up code line starting from a starting nested symbol; otherwise, creating one child node defined as child node N+1 in the initialization node; and looking for a parent node corresponding to the child node of the code line, and recording information about the parent node corresponding to the child node if the popped-up code line terminates at an ending nested symbol.

---

Claim 3:
3. The method according to claim 1 , wherein the method further comprises: traversing the code tree; acquiring a statement value of the parent node by using the initialization node as the parent node, and creating a statement box corresponding to the parent node, and displaying the statement value corresponding to the parent node in the statement box; acquiring the statement value of the converted code line stored in the child node, if the parent node has the child node; creating a statement box corresponding to the statement value of the converted code line of the child node according to a preset position offset amount between the child node and the parent node, and displaying the statement value of the converted code line in the statement box; and connecting the parent node and the child node, and displaying the code tree.