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).
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
MIRA Ltd.: MISRA-C:2004. Guidelines for the Use of the C Language in Critical Systems (October 2004)
The Programming Research Group: High-Integrity C++ Coding Standard Manual (May 2004)
Sun Microsystems, http://java.sun.com/products/javacard/
Global GCC project website, http://www.ggcc.info/
Source-Navigator, http://sourcenav.sourceforge.net/
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)
Kaneiwa, K.: Order-Sorted Logic Programming with Predicate Hierarchy. Artificial Intelligence 158(2), 155–188 (2004)
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)
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)
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)
Ellis, M.A., Stroustrup, B.: The Annotated C++ Reference Manual. Addison-Wesley, Reading (1990)
Taibi, T.: An Integrated Approach to Design Patterns Formalization. In: Design Pattern Formalization Techniques. IGI Publishing (March 2007)
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)
Mens, K., Michiels, I., Wuyts, R.: Supporting software development through declaratively codified programming. In: SEKE, pp. 236–243 (2001)
Hovemeyer, D., Pugh, W.: Finding bugs is easy. ACM SIGPLAN Notices 39(10), 132–136 (2004)
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)
Volanschi, E.N.: A portable compiler-integrated approach to permanent checking. In: ASE, pp. 103–112. IEEE Computer Society Press, Los Alamitos (2006)
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)
Schwitter, R.: Controlled natural languages, http://www.ics.mq.edu.au/~rolfs/controlled-natural-languages
Author information
Authors and Affiliations
Editor information
Rights 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)