Skip to main content

Automatic Coding Rule Conformance Checking Using Logic Programming

  • Conference paper
Practical Aspects of Declarative Languages (PADL 2008)

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.

Work partially supported by PROFIT grants FIT-340005-2007-7 and FIT-350400-2006-44 from the Spanish Ministry of Industry, Trade and Tourism; Comunidad Autónoma de Madrid grant S-0505/TIC/0407 (PROMESAS); Ministry of Education and Science grant TIN2005-09207-C03-01 (MERIT/COMVERS) and EU IST FET grant IST-15905 (MOBIUS).

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

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.

References

  1. MIRA Ltd.: MISRA-C:2004. Guidelines for the Use of the C Language in Critical Systems (October 2004)

    Google Scholar 

  2. The Programming Research Group: High-Integrity C++ Coding Standard Manual (May 2004)

    Google Scholar 

  3. Sun Microsystems, http://java.sun.com/products/javacard/

  4. Global GCC project website, http://www.ggcc.info/

  5. Source-Navigator, http://sourcenav.sourceforge.net/

  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. Kaneiwa, K.: Order-Sorted Logic Programming with Predicate Hierarchy. Artificial Intelligence 158(2), 155–188 (2004)

    Article  MATH  MathSciNet  Google Scholar 

  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. 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. 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. Ellis, M.A., Stroustrup, B.: The Annotated C++ Reference Manual. Addison-Wesley, Reading (1990)

    Google Scholar 

  12. Taibi, T.: An Integrated Approach to Design Patterns Formalization. In: Design Pattern Formalization Techniques. IGI Publishing (March 2007)

    Google Scholar 

  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)

    Chapter  Google Scholar 

  14. Mens, K., Michiels, I., Wuyts, R.: Supporting software development through declaratively codified programming. In: SEKE, pp. 236–243 (2001)

    Google Scholar 

  15. Hovemeyer, D., Pugh, W.: Finding bugs is easy. ACM SIGPLAN Notices 39(10), 132–136 (2004)

    Google Scholar 

  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)

    Article  Google Scholar 

  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. 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. Schwitter, R.: Controlled natural languages, http://www.ics.mq.edu.au/~rolfs/controlled-natural-languages

Download references

Author information

Authors and Affiliations

Authors

Editor information

Paul Hudak David S. Warren

Rights and permissions

Reprints and permissions

Copyright information

© 2007 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Marpons, G., Mariño, J., Carro, M., Herranz, Á., Moreno-Navarro, J.J., Fredlund, LÅ. (2007). Automatic Coding Rule Conformance Checking Using Logic Programming. In: Hudak, P., Warren, D.S. (eds) Practical Aspects of Declarative Languages. PADL 2008. Lecture Notes in Computer Science, vol 4902. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-77442-6_3

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-77442-6_3

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-77441-9

  • Online ISBN: 978-3-540-77442-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics