/CSharpProlog

A C# implementation of Prolog (port from https://sourceforge.net/p/cs-prolog )

Primary LanguageC#GNU Lesser General Public License v3.0LGPL-3.0

CSharpProlog NuGet Package Build status

A C# implementation of Prolog

// PM> Install-Package CSProlog -pre
using System;
using Prolog;

class Program
{
    static void Main(string[] args)
    {
        var prolog = new PrologEngine(persistentCommandHistory: false);

        // 'socrates' is human.
        prolog.ConsultFromString("human(socrates).");
        // human is bound to die.
        prolog.ConsultFromString("mortal(X) :- human(X).");

        // Question: Shall 'socrates' die?
        var solution = prolog.GetFirstSolution(query: "mortal(socrates).");
        Console.WriteLine(solution.Solved); // = "True" (Yes!)
    }
}

Solution Layout

CSProlog

Prolog Engine

CSProlog.Core.Test

Unit Tests

PL.NETCore

Dotnet Core Console Interactive Interpreter (tested in linux and windows)

PLd

DOS Console Interactive Interpreter

PLw

Windows Forms Example

PLx

An example of how to use the engine within another Program

License

GNU LGPL v.3