Abstract
In this paper a method is proposed for carrying out analysis of imperative programs. We achieve this by writing down the language semantics as a declarative program (a constraint logic program, in the approach shown here). We propose an effective style of writing operational semantics suitable for analysis which we call one-state small-step semantics. Through controlled partial evaluation we are able to generate residual programs where the relationship between imperative statements and predicates is straightforward. Then we use a static analyser for constraint logic programs on the residual program. The analysis results are interpreted through program points associating predicates in the partially evaluated interpreter to statements in its corresponding imperative program. We used an analyser that allows us to determine linear equality, inequality and disequality relations among the variables of a program without user-provided inductive assertions or human interaction. The proposed method intends to serve as a framework for the analysis of programs in any imperative language. The tools required are a partial evaluator and a static analyser for the declarative language.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. Addison Wesley, 1986.
P. Cousot and N. Halbwachs. Automatic discovery of linear restraints amog variables of a program. In Proceedings of the Conference Record of the 5th ACM Symposium on Principles of Programming Languages, pages 84–97, Albuquerque, New Mexico, 1978.
Patrick Cousot. Abstract interpretation based static analysis parametrized by semantics. In Proceedings of the Fourth International Symposium on Static Analysis, SAS’97, pages 388–394, Paris, France, 1997. LNCS 1302, Springer Verlag.
J.P. Gallagher. Tutorial on specialisation of logic programs. In Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 88–98, Copenhagen, Denmark, 1993. ACM Press.
J. Gallagher and M. Bruynooghe. Some low-level source transformations for logic programs. In Proceedings of Meta90 Workshop on Meta Programming in Logic. Katholieke Universiteit Leuven, Belgium, 1990.
J. Gallagher and M. Bruynooghe. The derivation of an algorithm for program specialisation. New Generation Computing, 9(3&4):305–333, 1991.
J. Gallagher and D.A. de Waal. Fast and precise regular approximation of logic programs. In P. Van Hentenryck, editor, Proceedings of the International Conference on Logic Programming (ICLP’94), Santa Margherita Ligure, Italy. MIT Press, 1994.
Valérie Gouranton and Daniel Le Métayer. Formal development of static program analysers. In Proceedings of the 8th Israeli Conference on Computer Systems and Software Engineering, pages 101–110, Israel, 1997.
Donald E. Knuth. The Art of Computer Programming, volume 3 of Sorting and Searching. Addison-Wesley Publishing Company, 1973.
Robert Kowalski. Logic for Problem Solving. North Holland, 1979.
Michael Leuschel. Advanced Techniques for Logic Program Specialisation. PhD thesis, Katholieke Universiteit Leuven, Department of Computer Science, Leuven, Belgium, May 1997.
J. W. Lloyd and J. C. Shepherdson. Partial evaluation in logic programming. The Journal of Logic Programming, 11(3&4):217–242, 1991.
Flemming Nielson. Two-level semantics and abstract interpretation. Theoretical Computer Science, (69):117–242, 1989.
Flemming Nielson. Semantics-directed program analysis: A toolmaker’s perspective. In Third International Symposium, SAS’96. Springer Verlag, LNCS 1145, 1996.
Flemming Nielson and Hanne Riis Nielson. Two-level semantics and code generation. Theoretical Computer Science, (56):59–133, 1988.
Hanne Riis Nielson and Flemming Nielson. Semantics with Applications. John Wiley and Sons, 1992.
John L. Ross and Mooly Sagiv. Building a bridge between pointer aliases and program dependences. In European Symposium On Programming, Lisbon, Portugal, 1998.
Hüseyin Sağlam. A Toolkit for Static Analysis of Constraint Logic Programs. PhD thesis, Bristol University, Department of Computer Science, Bristol, U.K., March 1998.
Mooly Sagiv, Nissim Francez, Michael Rodeh, and Reinhard Wilhelm. A logic-based approach to program flow analysis. 1998. Submitted to Acta Informatica.
H. Sağlam and J. Gallagher. Constrained regular approximation of logic programs. In N. Fuchs, editor, Logic Program Synthesis and Transformation (LOPSTR’97). Springer-Verlag, Lecture Notes in Computer Science, 1998. in press.
Clark Verbrugge, Phong Co, and Laurie Hendren. Generalized constant propagation a study of C. Lecture Notes in Computer Science, Compiler Construction, (1060):74–90, 1996.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Peralta, J.C., Gallagher, J.P., Sağlam, H. (1998). Analysis of Imperative Programs through Analysis of Constraint Logic Programs. In: Levi, G. (eds) Static Analysis. SAS 1998. Lecture Notes in Computer Science, vol 1503. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-49727-7_15
Download citation
DOI: https://doi.org/10.1007/3-540-49727-7_15
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-65014-0
Online ISBN: 978-3-540-49727-1
eBook Packages: Springer Book Archive