摘要
A two-phase monadic approach is presented for monadically slicing programs with procedures. In the monadic slice algorithm for interprocedural programs, phase 1 initializes the slice table of formal parameters in a procedure with the given labels, and then captures the callees' influence on callers when analyzing call statements. Phase 2 captures the callees' dependence on callers by replacing all given labels appearing in the corresponding sets of formal parameters. By the introduction of given labels, this slice method can obtain similar summary information in system-dependence-graph(SDG)-based algorithms for addressing the calling-context problem. With the use of the slice monad transformer, this monadic slicing approach achieves a high level of modularity and flexibility. It shows that the monadic interprocedural algorithm has less complexity and it is not less precise than SDG algorithms.
为解决含过程程序的单子切片问题,提出基于回填待定标号的两阶段单子切片算法.算法第1阶段用给定标号初始化子过程的形参切片表,并通过分析调用语句捕获被调者对调用者的影响.算法第2阶段主要是通过回填切片表中相应的待定标号来捕获施调者对被调者的影响.待定标号的引入使得所提切片算法可捕获类似基于系统依赖图(SDG)切片算法中的概要信息,且也可避免上下文调用问题.借助于切片单子转换器,所提单子切片算法将具有较高的模块性和适应性,且其复杂度不劣于基于SDG的切片算法.
基金
The National Outstanding Young Scientist Foundation by NSFC(No.60703086,60503020)