Once the abstract syntax tree is obtained, each statement block is divided into multiple subtrees, and the instruction splitting is performed by traversing the tree in post-order. For computational operations, specifically for nodes of type 'InfixExpression' in the syntax tree, as shown in the code on the top left of the diagram, the operands and operators are separated and split into intermediate instructions based on a stack-based architecture.
Before performing statement splitting, it is necessary to flatten and split the structures such as branches and loops. The diagram below illustrates the splitting process for a conditional branch structure. Through structural splitting, an IF subtree is divided into multiple expression subtrees, each containing only one statement block. The "ifjmp" and "elsepart" markers are inserted to facilitate the insertion of branch jump instructions and destination addresses during the virtual mapping process, ensuring the correctness of program execution. The splitting operation for loop structures is similar, except that in addition to splitting the condition module and loop body, a forward jump instruction is added at the end of the loop body to ensure the restoration of loop logic.