Skip to main content

Imperative Program Specialisation: An Approach Using CLP

Julio C. Peralta, John P. Gallagher, Imperative Program Specialisation: An Approach Using CLP. Logic-Based Program Synthesis and Transformation (LOPSTR'99), (ed. A. Bossi), pp. 103–118. April 2000. No electronic version available.


The semantics of an imperative programming language can be expressed as a program in a declarative constraint language. Not only does this render the semantics executable, but it opens up the possibility of applying to imperative languages the advances made in program analysis and transformation of declarative languages. We propose a method for carrying out partial evaluation of imperative programs, using partial evaluation in a declarative language, but returning the results in the syntax of the imperative program which is to be partially evaluated. The approach uses a special form of the semantics and program points to aid partial evaluation in the reconstruction of a specialised imperative program from a partially evaluated semantics program. Constraints provide a means through which information is propagated inside both branches of a conditional, the body of a loop, and along chains of def-use chains in the program. The method provides a framework for constructing a partial evaluator for any imperative programming language, by writing down its semantics as a declarative program (a constraint logic program, in the approach shown here).

Bibtex entry.

Contact details

Publication Admin