Automatic Coding Rule Conformance Checking Using Logic Programming

  • Guillem Marpons
  • Julio Mariño
  • Manuel Carro
  • Ángel Herranz
  • Juan José Moreno-Navarro
  • Lars-Åke Fredlund
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4902)

Abstract

An extended practice in the realm of Software Engineering and programming in industry is the application of coding rules. Coding rules are customarily used to constrain the use (or abuse) of certain programming language constructions. However, these rules are usually written using natural language, which is intrinsically ambiguous and which may complicate their use and hinder their automatic enforcement. This paper presents some early work aiming at defining a framework to formalise and check for coding rule conformance using logic programming. We show how a certain class of rules – structural rules – can be reformulated as logic programs, which provides both a framework for formal specification and also for automatic conformance checking using a Prolog engine. Some examples of rules belonging to actual, third-party coding rule sets are discussed, along with the corresponding Prolog code. Experimental data regarding the practicality and impact of their application to real-life software projects is presented and discussed.

Keywords

Coding rule checking Declarative domain-specific languages and applications Logic programming Programming environments 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    MIRA Ltd.: MISRA-C:2004. Guidelines for the Use of the C Language in Critical Systems (October 2004)Google Scholar
  2. 2.
    The Programming Research Group: High-Integrity C++ Coding Standard Manual (May 2004)Google Scholar
  3. 3.
  4. 4.
    Global GCC project website, http://www.ggcc.info/
  5. 5.
  6. 6.
    Hermenegildo, M., Bueno, F., Cabeza, D., Carro, M., de la Banda, M.G., López-García, P., Puebla, G.: The CIAO Multi-Dialect Compiler and System: An Experimentation Workbench for Future (C)LP Systems. In: Parallelism and Implementation of Logic and Constraint Logic Programming, Nova Science, Commack, NY, USA, pp. 65–85 (April 1999)Google Scholar
  7. 7.
    Kaneiwa, K.: Order-Sorted Logic Programming with Predicate Hierarchy. Artificial Intelligence 158(2), 155–188 (2004)MATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    Ramakrishnan, I.V., Rao, P., Sagonas, K.F., Swift, T., Warren, D.S.: Efficient tabling mechanisms for logic programs. In: ICLP, pp. 697–711 (1995)Google Scholar
  9. 9.
    Muñoz-Hernández, S., Moreno-Navarro, J., Hermenegildo, M.: Efficient negation using abstract interpretation. In: Nieuwenhuis, R., Voronkov, A. (eds.) Logic for Programming, Artificial Intelligence and Reasoning, La Habana (Cuba) (2001)Google Scholar
  10. 10.
    Muñoz, S., Mariño, J., Moreno-Navarro, J.J.: Constructive intensional negation. In: Kameyama, Y., Stuckey, P.J. (eds.) FLOPS 2004. LNCS, vol. 2998, pp. 39–54. Springer, Heidelberg (2004)Google Scholar
  11. 11.
    Ellis, M.A., Stroustrup, B.: The Annotated C++ Reference Manual. Addison-Wesley, Reading (1990)Google Scholar
  12. 12.
    Taibi, T.: An Integrated Approach to Design Patterns Formalization. In: Design Pattern Formalization Techniques. IGI Publishing (March 2007)Google Scholar
  13. 13.
    Blewitt, A., Bundy, A., Stark, I.: Automatic verification of design patterns in java. In: Redmiles, D.F., Ellman, T., Zisman, A. (eds.) ASE 2005. 20th IEEE/ACM International Conference on Automated Software Engineering, Long Beach, CA, USA, November 7-11, 2005, pp. 224–232. ACM Press, New York (2005)CrossRefGoogle Scholar
  14. 14.
    Mens, K., Michiels, I., Wuyts, R.: Supporting software development through declaratively codified programming. In: SEKE, pp. 236–243 (2001)Google Scholar
  15. 15.
    Hovemeyer, D., Pugh, W.: Finding bugs is easy. ACM SIGPLAN Notices 39(10), 132–136 (2004)Google Scholar
  16. 16.
    Hallem, S., Chelf, B., Xie, Y., Engler, D.: A system and language for building system-specific, static analyses. ACM SIGPLAN Notices 37(5), 69–82 (2002)CrossRefGoogle Scholar
  17. 17.
    Volanschi, E.N.: A portable compiler-integrated approach to permanent checking. In: ASE, pp. 103–112. IEEE Computer Society Press, Los Alamitos (2006)Google Scholar
  18. 18.
    Martin, M., Livshits, B., Lam, M.S.: Finding application errors and security flaws using PQL: A program query language. In: OOPSLA 2005. Proceedings of Object-Oriented Programming, Systems, Languages, and Applications, New York, NY, USA, pp. 363–385. ACM Press, New York (2005)Google Scholar
  19. 19.
    Schwitter, R.: Controlled natural languages, http://www.ics.mq.edu.au/~rolfs/controlled-natural-languages

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Guillem Marpons
    • 1
  • Julio Mariño
    • 1
  • Manuel Carro
    • 1
  • Ángel Herranz
    • 1
  • Juan José Moreno-Navarro
    • 1
    • 2
  • Lars-Åke Fredlund
    • 1
  1. 1.Universidad Politcnica de Madrid 
  2. 2.IMDEA Software 

Personalised recommendations