Patent ID: 6516461
Filing Date: 2003-02-04
Classification: G06F

Abstract:
A method of translating an input source code described in a particular programming language that meets the following requirements, into a corresponding output source code in any language that may be the same as or different from the original language, the requirements being that:a statement and an expression be distinguished according to the syntax rules; any expression statement containing an expression followed by a separator be defined as one of the statements; for each construct, whether it is an expression or a statement be predefined; and for each construct, whether each of the items comprising the construct is an expression or a statement be able to be determined, wherein so that an input source code represented as an abstract syntax tree without using nodes corresponding to separators representing expression statement may be produced as a corresponding output source code, the method comprises the steps of: outputting the abstract syntax tree as a statement; outputting the abstract syntax tree as an expression; and producing each corresponding construct, wherein said step of outputting the abstract syntax tree as a statement depends on the type of the root node in the abstract syntax tree being output, and includes the steps of: if the root node is a node representing a statement, producing each corresponding construct according to the type of that statement; and if the root node is a node representing an expression, outputting the abstract syntax tree as an expression and then producing a separator representing an expression statement, wherein said step of outputting the abstract syntax tree as an expression depends on the type of the root node in the abstract syntax tree, and includes the step of producing each corresponding construct according to the type of that expression.