To use P#, you require a C# compiler and the ability to run C# programs.
To install P#, download and unzip the following file: Psharp-1.1.2.zip. This file contains:
The source code (both Prolog and C#) is contained in the demo zip file which can be downloaded below.
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
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 Psharp.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
main/0 in the Prolog file you compiled. To run another predicate
of arity zero, say
my_pred you can use the command
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# 1.1 is based on Prolog Cafe version 0.44). See the manual for details of the differences between P# and Prolog Cafe.
A screenshot of the Graphical User Interface for P#, this can be downloaded above.
A screenshot of a Web Application which allows the user to play a game of noughts and crosses
A screenshot of an object oriented assistant, which allows the user to query the C# namespaces or Java packages.
A screenshot of a class hierarchy viewer.
A screen shot of the agents example discussed in the concurrency paper.