Skip to main content

Analysis of Imperative Programs through Analysis of Constraint Logic Programs

  • Conference paper
  • First Online:
Static Analysis (SAS 1998)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1503))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. Addison Wesley, 1986.

    Google Scholar 

  2. 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.

    Google Scholar 

  3. 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.

    Google Scholar 

  4. 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.

    Google Scholar 

  5. 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.

    Google Scholar 

  6. J. Gallagher and M. Bruynooghe. The derivation of an algorithm for program specialisation. New Generation Computing, 9(3&4):305–333, 1991.

    Article  Google Scholar 

  7. 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.

    Google Scholar 

  8. 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.

    Google Scholar 

  9. Donald E. Knuth. The Art of Computer Programming, volume 3 of Sorting and Searching. Addison-Wesley Publishing Company, 1973.

    Google Scholar 

  10. Robert Kowalski. Logic for Problem Solving. North Holland, 1979.

    Google Scholar 

  11. Michael Leuschel. Advanced Techniques for Logic Program Specialisation. PhD thesis, Katholieke Universiteit Leuven, Department of Computer Science, Leuven, Belgium, May 1997.

    Google Scholar 

  12. J. W. Lloyd and J. C. Shepherdson. Partial evaluation in logic programming. The Journal of Logic Programming, 11(3&4):217–242, 1991.

    Article  MathSciNet  MATH  Google Scholar 

  13. Flemming Nielson. Two-level semantics and abstract interpretation. Theoretical Computer Science, (69):117–242, 1989.

    Google Scholar 

  14. Flemming Nielson. Semantics-directed program analysis: A toolmaker’s perspective. In Third International Symposium, SAS’96. Springer Verlag, LNCS 1145, 1996.

    Google Scholar 

  15. Flemming Nielson and Hanne Riis Nielson. Two-level semantics and code generation. Theoretical Computer Science, (56):59–133, 1988.

    Google Scholar 

  16. Hanne Riis Nielson and Flemming Nielson. Semantics with Applications. John Wiley and Sons, 1992.

    Google Scholar 

  17. John L. Ross and Mooly Sagiv. Building a bridge between pointer aliases and program dependences. In European Symposium On Programming, Lisbon, Portugal, 1998.

    Google Scholar 

  18. 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.

    Google Scholar 

  19. Mooly Sagiv, Nissim Francez, Michael Rodeh, and Reinhard Wilhelm. A logic-based approach to program flow analysis. 1998. Submitted to Acta Informatica.

    Google Scholar 

  20. 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.

    Google Scholar 

  21. 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.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics