There is now a new version.

Downloading P# (version 0.1)

To use P#, you require a C# compiler and the ability to run C# programs.

To install P# you should download the following files:

The source code (both Prolog and C#) is also available:

You should add Psharp.dll to the Global Assembly Cache (GAC). Having done this you can run P# by executing the Psharp.exe file. It is possible to run Psharp.exe without putting Psharp.dll in the GAC, simply by placing the two files in the same folder. However, putting Psharp.dll in the GAC makes it easier for C# programs generated by P# to find the DLL (alternatively you can add a reference to some copy of the DLL when you compile your C# files).

To translate a Prolog source file, called myfile.pl, say, run P# and enter the command

compile('myfile').

then press CTRL-Z to exit P#.

If the compilation was successful there will now be a number of C# files in the directory. Copy the file Loader.cs into the directory as well.

Assuming that your csc (C# compile) command is reachable from the path, and that you have put your P#.dll file in the folder C:\psharp, say, you should then be able to compile these into a P# application with the following command:

csc /r:"C:\psharp\Psharp.dll" /out:MyProgram.exe *.cs

This generates an executable file which when run will load the P# dll and start executing the predicate main/0 in the Prolog file you compiled. To run another predicate of arity zero, say my_pred you can use the command

MyProgram.exe MyPred

Notice how Prolog predicate names are renamed (if in doubt just look at the class name in the generated C# file).

Using P# is very similar to using Prolog Cafe (P# 0.1 is based on Prolog Cafe version 0.44). We have added one extra predicate: loadAssembly/1, which is passed an assembly name (as a term). This assembly, and any predicates defined in it then become visible to P#.