MPprogramming.com
Home C++
 
       

Castor : Logic paradigm for C++

Traditional approach to problem solving with computers is all about instructing the computer exactly how to solve the problem. This is called the Imperative paradigm and is based on the Turing machine. Languages such as C, C++, Java, Fortran etc. are all rooted in this paradigm.

The Logic paradigm (LP) is a declarative programming model. Instead of instructing the computer how to solve a particular problem, we describe the problem domain as facts and rules. Using the problem domain description, the computer figures out how to solve specific problems within that domain. Once the domain has been described, many different problems within that domain can be solved without additional code. Describing the problem domain and the specific problems that need to be solved are tasks for a programmer.

Logic programming is one approach in computer science towards what is sometimes referred to as the Holy Grail of programming: "The user states the problem, the computer solves it".

Prolog is the best known programming language that supports logic programming. The computational model underlying LP is rooted in Predicate calculus. This is analogous to the Turing machine which is the computational model for the imperative paradigm.

Castor is a small (under 5k LOC), pure C++, all header library. It seamlessly integrates LP with the other programming paradigms supported by C++ such as OOP, generic programming, imperative etc. Blending LP into C++ enables new designs and programming techniques that are not available to purely LP approaches or pure OO approaches, but only feasible within a multiparadigm blend. A key design goal of Castor is to smoothly and efficiently blend Logic into the rest of C++ with minimal syntactic overhead.

Castor v1.0   can be downloaded for free. Castor is distributed under the MIT license. Send your questions, feedback and technical contributions to roshan AT mpprogramming DOT c o m.

Documentation :

a) Get started with this introduction  to Logic Programming in C++ (draft).

b) Reference manual  for Castor.

c) A discussion on the design and implementation (revised on Feb 24th '08) of the core parts which enable the Logic paradigm in C++. See how support for this declarative paradigm is built using only a few lines code.

Recent Talks :

For hosting a talk on Logic Programming and C++ contact roshan AT mpprogramming DOT c o m.

    Logic Paradigm for C++ at SD West 2008: at SD West 2008: See session details.
Northwest C++ Users Group
April 16, 2008
Redmond, WA
90 min session on Logic Paradigm for C++ : Open to public! Bring Your own OBjects (BYOB) and logic will be provided in this 90 minute talk on general purpose declarative programming with the Logic paradigm (LP). In this code centric presentation, Roshan Naik takes you through the basics of LP, LP with Castor and Multiparadigm programming. See session details.
       
 
MPprogramming.com