Support for the Logic paradigm in C++ (with Castor)

R

Roshan Naik

Castor is a pure C++ Library that introduces the Logic paradigm (LP) into
C++. Although

LP has been well explored in Computer science, it remains under utilized in
main stream

software development due to lack of support in popular programming
languages. Among the

few languages that do support it, Prolog is perhaps the most commonly known.

Instead of attempting to embed a Logic interpreter or other heavy weight
engine into C++,

Castor integrates LP using a few simple library primitives. This unique
approach

allows a natural and deep integration of declarative code into the language,
and

also provides the flexibility of combining Logic with other paradigms
natively supported

by C++ such as OOP, generics etc. STL concepts like iterators ,containers
and streams

can also be used in declarative code.

Castor is an open source library distributed under the MIT license

(http://www.opensource.org/licenses/mit-license.php). It is relatively small
(under 5k LOC)

and can be downloaded for free from http://www.mpprogramming.com

For an introductory tutorial on LP and understanding its use in C++ refer to

http://www.mpprogramming.om/resources/CastorTutorial.pdf

Feedback, comments and contributions are welcome.
 
K

kwikius

Castor is a pure C++ Library that introduces the Logic paradigm (LP) into
C++.
For an introductory tutorial on LP and understanding its use in C++ refer to

http://www.mpprogramming.om/resources/CastorTutorial.pdf

Feedback, comments and contributions are welcome.

Only had time for a brief look, but looks interesting.

Here's a little app I called ASQE (Andy's simple query engine which I
put up on comp.programming a while ago.
There are various versions under my "kwikius" moniker,
showing overloads for in memory and also a scripted version.(Try the
later version of scripted variety on the thread as earlier one had
bugs) May be worth looking at to substitute operatrs for "eq" in
queries. eg(sample script query)

first_name = John && !( last_name != Smith || country = England )


http://tinyurl.com/36qchr

regards
Andy Little
 
N

naikrosh

May be worth looking at to substitute operatrs for "eq" in
queries. eg(sample script query)


The equality operator on lref<T> is put to more interesting use (refer
to chapter 3 in tutorial).
The design decision regarding eq() v/s operator==() is explained on
Page 7 of the Design document.

-Roshan
 
C

Carlo Capelli

Roshan Naik said:
Castor is a pure C++ Library that introduces the Logic paradigm (LP) into
C++. Although

LP has been well explored in Computer science, it remains under utilized
in main stream

software development due to lack of support in popular programming
languages. Among the

few languages that do support it, Prolog is perhaps the most commonly
known.

Instead of attempting to embed a Logic interpreter or other heavy weight
engine into C++,

Castor integrates LP using a few simple library primitives. This unique
approach

allows a natural and deep integration of declarative code into the
language, and

also provides the flexibility of combining Logic with other paradigms
natively supported

by C++ such as OOP, generics etc. STL concepts like iterators ,containers
and streams

can also be used in declarative code.

Castor is an open source library distributed under the MIT license

(http://www.opensource.org/licenses/mit-license.php). It is relatively
small (under 5k LOC)

and can be downloaded for free from http://www.mpprogramming.com

For an introductory tutorial on LP and understanding its use in C++ refer
to

http://www.mpprogramming.om/resources/CastorTutorial.pdf

Feedback, comments and contributions are welcome.

Hi Roshan.
Your work is very interesting.
Currently i'd like to approach the same problem from the easier C#.
Do you benchmarked your system (something like tak, nrev or similar)?
Bye Carlo
 
R

Roshan Naik

Hi Roshan.
Your work is very interesting.
Currently i'd like to approach the same problem from the easier C#.

My (not very dedicated) attempts have gone nowehere due to the simplistic
generics and operator overloading support in C#.
On the bright side, C# has direct support for coroutines... one of the two
key
techniques (the other being type erasure) that makes Castor possible.
Do you benchmarked your system (something like tak, nrev or similar)?

Limited resources have not allowed me to pursue benchmarking.

-Roshan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top