Reverse program calculation supported by code slicing

This paper sketches a discipline for reverse engineering which combines formal and semi-formal methods. Among the former is the "algebra of programming", which we apply in "reverse order" so as to reconstruct formal specifications of legacy code. The latter includes code slicing, used as a means of trimming down the complexity of handling the formal semantics of all program variables at the same time. A strong point of the approach is its constructive style. Reverse calculations go as far as imploding auxiliary variables, introducing mutual recursion (if applicable) and transforming semantic functions into standard generic programming schemata such as cata/paramorphisms. We illustrate the approach by reversing a piece of code (from C to Haskell) already studied in the code-slicing literature: the word-count (wc) program.

[1]  John Darlington,et al.  A Transformation System for Developing Recursive Programs , 1977, J. ACM.

[2]  Ralf Hinze,et al.  Haskell 98 — A Non−strict‚ Purely Functional Language , 1999 .

[3]  Mark Harman,et al.  Program comprehension assisted by slicing and transformation , 1995 .

[4]  Arie van Deursen,et al.  Understanding COBOL systems using inferred types , 1999, Proceedings Seventh International Workshop on Program Comprehension.

[5]  Mark Harman,et al.  Projecting functional models of imperative programs , 1993, SIGP.

[6]  Arie van Deursen,et al.  Identifying objects using cluster and concept analysis , 1999, Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).

[7]  Aniello Cimitile,et al.  Conditioned program slicing , 1998, Inf. Softw. Technol..

[8]  G. A. Venkatesh,et al.  The semantic approach to program slicing , 1991, PLDI '91.

[9]  John W. Backus,et al.  Can programming be liberated from the von Neumann style?: a functional style and its algebra of programs , 1978, CACM.

[10]  James H. Cross,et al.  Reverse engineering and design recovery: a taxonomy , 1990, IEEE Software.

[11]  Betty H. C. Cheng,et al.  A formal approach for reverse engineering: a case study , 1999, Sixth Working Conference on Reverse Engineering (Cat. No.PR00303).

[12]  Richard S. Bird,et al.  Algebra of programming , 1997, Prentice Hall International series in computer science.

[13]  Betty H. C. Cheng,et al.  Using informal and formal techniques for the reverse engineering of C programs , 1996, Proceedings of WCRE '96: 4rd Working Conference on Reverse Engineering.