Research Article
[Retracted] Automatic Grading for Complex Multifile Programs
Algorithm 2
Program standardization using AST algorithm.
| | Variable: | | | ASTdata[]: program AST data map | | | fASTdata[]: final refactored program AST data map | | | Input: | | | pAST: program AST | | | sb[]: syntax bank | | | Output: final standardized program AST fsAST | | | Begin: | | (1) | Step 1: Traverse and visit pAST with ASTVisitor class, do Step 2 | | (2) | Step 2: Handle AST node for AST data mapper to get ASTdata[] | | (3) | Index = 0 | | (4) | for every AST node | | (5) | initialization ASTdata[] key (see detail in Table 3) | | (6) | node = AST node, current tag = AST tag | | (7) | if current tag = function statement or expression | | (8) | syntax = nodeParser(node) | | (9) | if syntax not exists on sb[]//syntax classifier | | (10) | inner user function node | | (11) | else | | (12) | inner standard function node | | (13) | if current tag ≠ previous tag | | (14) | exit no = index (exit AST node branch tree) | | (15) | node info = flag based on node and tag information, process no = index | | (16) | index ++ | | (17) | add ASTdata[index] | | (18) | Step 3: Handle AST data for refactoring to get final ASTdata[] | | (19) | fASTdata[] = RefactoringCore(ASTdata[i]) | | (20) | Step 4: Rebuild final source from fASTdata[] to get fsAST | | (21) | for i = 0 to fASTdata[] size | | (22) | fsAST = fsAST add node(fASTdata[i]) | | (23) | End |
|