Blending the Logic Paradigm into C + +

The Logic paradigm (LP) provides a powerful programming model that has been underrepresented in mainstream programming as compared to the object-oriented, functional and imperative paradigms. Lot of work can be cited in the space of integrating logic into functional programming or the functional into imperative paradigm but relatively less has been written about integrating logic programming into popular object-oriented languages used by the majority of software developers. Consequently a vast unexplored territory exists in the space of multiparadigm programming techniques that leverage logic programming in the dominant universe of imperative and object–oriented programming. This paper introduces a technique for seamlessly integrating Logic programming techniques into C++. In this approach, support for LP is provided in the form of a few library primitives and does not require any extensions or modifications to the C++ language. The proposed technique is directly based on the imperative paradigm and can be implemented in about 400 lines of C++ code. The code presented here is based on the Castor library. More advanced facilities, built using the core parts described here, are provided in Castor but not covered in this paper.