|
ABSTRACT
While a compiler produces low-level object code from high-level source code, a decompiler produces high-level code from low-level code and has applications in the testing and validation of safety-critical software. The decompilation of an object code provides an independent demonstration of correctness that is hard to better for industrial purposes (an alternative is to prove the compiler correct). But, although compiler compilers are in common use in the software industry, a decompiler compiler is much more unusual.It turns out that a data type specification for a programming-language grammar can be remolded into a functional program that enumerates all of the abstract syntax trees of the grammar. This observation is the springboard for a general method for compiling decompilers from the specifications of (nonoptimizing) compilers.This paper deals with methods and theory, together with an application of the technique. The correctness of a decompiler generated from a simple occam-like compiler specification is demonstrated. The basic problem of enumerating the syntax trees of grammars, and then stopping, is shown to have no recursive solution, but methods of abstract interpretation can be used to guarantee the adequacy and completeness of our technique in practical instances, including the decompiler for the language presented here.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
| |
2
|
|
| |
3
|
|
| |
4
|
BOWEN, J. P. 1992. From programs to object code using logic and logic programming. In Code Generation--Concepts, Tools, Techniques, R. Giegerich and S. L. Graham, Eds. Workshops in Computing. Springer-Verlag, New York, 173-192.
|
| |
5
|
BOWEN, J. P. 1993. From programs to object code and back again using logic programming: Compilation and decompilation. J. Softw. Maint. Res. Pract. 5, 4 (Dec.), 205-234.
|
| |
6
|
|
| |
7
|
BOWEN, J. P., AND STAVRWOU, V. 1993. Safety-critical systems, formal methods and standards. 1EE/BCS Softw. Eng. J. 8, 4 (July), 189-209.
|
| |
8
|
BOWEN, J. P., BREWER, P. T., AND LANO, K. C. 1993a. A compendium of' formal techniques for software maintenance. IEE/BCS Soflw. Eng. J. 8, 5 (Sept.), 253-262.
|
| |
9
|
BOWEN, J. P., BREUER, P. T., ANI) LANO, K. C. 1993b. Formal specifications in software maintenance: From code to Z++ and back again. Inf. Softw. Teeh. 35, 11-12 (Nov.-Dec.), 679-690.
|
| |
10
|
|
| |
11
|
BREUER, P. T., AND BOWEN, J. P. 1992. Decompilation is the efficient enumeration of types. In Journdes de Travail WSA'92 Analyse Statique, vol. BIGRE 81-82, M. Billaud et al., Eds. IRISA-Campus de Beaulieu, Rennes Cedex, France, 255-273.
|
| |
12
|
BREUER, P. T., AND LANO, K. C. 1991. Creating specifications from code: Reverse engineering techniques. J. Softw. Maint. Res. Pract. 3, 3 (Sept.), 145-162.
|
| |
13
|
CLARK, K. L., MCCABE, F., AND GREGORY, S. 1982. IC-PROLOG language features. In Logic Programming, K. L. Clark and S.-A. Tarnlund, Eds. Academic Press, New York.
|
| |
14
|
|
 |
15
|
|
| |
16
|
DERANSART, P., AND MA~USZYI~SKI, J. 1987. Relating logic programs and attribute grammars. J. Logic Program. 3, 2, 125-163.
|
| |
17
|
DERANSART, P., JOURDAN, M., AND LORHO, B. 1988. Attribute Grammars. Lecture Notes in Computer Science, vol. 323. Springer-Verlag, New York.
|
| |
18
|
|
| |
19
|
HOARE, C. A. R. 1991. Refinement algebra proves correctness of compiling specifications. In 3rd Refinement Workshop, C. C. Morgan and J. C. P. Woodcock, Eds. Workshops in Computing. Springer-Verlag, New York, 33-48.
|
| |
20
|
HOARE, C. A. R., HE, J., BOWEN, j. P~, AND PANDYA, P. K. 1990~ An algebraic approach to verifiable compiling specification and prototyping of the ProCoS level 0 programming language. In ESPRIT '90 Conference Proceedings. Kluwer Academic Publishers, Dordrecht, The Netherlands, 804-818.
|
| |
21
|
HOOD, S. T. 1991. Decompiling with definite clause grammars. Res. Rep. ERL-0571-RR, Defence Science and Technology Organisation, Electronics Research Laboratory, Salisbury, South Australia, Sept.
|
| |
22
|
|
| |
23
|
|
| |
24
|
KLEENE, S. C. 1967. Mathematical Logic. John Wiley, New York.
|
| |
25
|
LANO, K. C., AND BR~;UER, P. T. 1990. From programs to Z specifications. In Z User Workshop, Oxford1989, J. E. Nicholls, Ed. Workshops in Computing. Springer-Verlag, New York, 46-70.
|
| |
26
|
|
| |
27
|
|
| |
28
|
PAVEY, D. g., AND WINSBORROW, L. A. 1993. Demonstrating equivalence of source code and PROM contents. Comput. J. 36, 7, 654-667.
|
 |
29
|
|
| |
30
|
TURNER, D. A. 1992. Functional programming and Miranda. IFIP Trans. A Comput. Sci. Tech. 12, 32-41.
|
| |
31
|
|
| |
32
|
WADLER, P. 1987. List comprehensions. In The Implementation of Functional Programming Languages, S. L. Peyton-Jones, Ed. Prentice-Hall International Series in Computer Science. Prentice-Hall, Hemel Hempstead, U.K.
|
| |
33
|
WARD, M., CALLISS, F. W., AND MUNRO, M. 1989. The maintainer's assistant. In Proceedings of the Conference on Software Maintenance. IEEE, New York, 307-315.
|
REVIEW
"R. Clayton : Reviewer"
A decompiler accepts low-level object code and produces the
high-level source code that compiles into the object code. This paper
describes a technique for constructing decompilers using attribute
grammars and functional programming.
more...
|