Skip to Main Content
Code variations are widely believed to impede program analysis. This paper introduces an approach for removing code variations in programs with function calls. Non-recursive programs and recursive programs are handled with different strategies. An inlining algorithm based on system dependence graph is developed to remove the module structure variation in non-recursive programs. Recursive programs are not in lined, but also normalized by performing semantic-preserving transformations on system dependence graphs. As a result, semantically equivalent constructs are transformed to the same system dependence graph representation, so that code variations are removed. This approach has been applied to similar code detection and automatic grading of student programs. Test results show that it can efficiently remove code variations and improve program analysis.