Squl
The Declarative Programming Language
What is Squl?
Squl is a declarative programming language, like Prolog.
A Squl application consists of modules containing statements. Each statement states some logical thought about the world. Statements look like this:
father:arnold of:bob.
father:bob of:charles.
then:( grandfather:X of:Z )
if:( father:X of:Y )
if:( father:Y of:Z ).
Here, we declare three bits of information. Firstly, arnold is the father of bob. Secondly, bob is the father of charles. Thirdly, somebody's father's father is their grandfather.
Note: don't get too attached to the syntax. It will change radically in version 0.4.
Running Faish
Squl is the language. Faish is a prototype Squl interpreter, written using VisualWorks Smalltalk.
Download the file "Faish_0.3.zip" and extract the contents to a suitable location.
- Windows:
- Unzip the zip file to, for example, "C:\Faish\", and double-click on "Faish.exe".
- Linux:
- Unzip the zip file somewhere, for example, "~/faish/" and double-click on "faish.sh", or in a console window, run "faish faish.im".
- Others:
- Download Cincom VisualWorks Smalltalk from http://www.cincomsmalltalk.com/ for your platform, locate the bin/visual executable for your platform and follow Cincom's documentation to run the faish.im image.
Alternatively, check out the source code and see the instructions in readme.txt
Using Faish
When started, you should get a "Your Modules" window. Click on "New", choose a nice name, then double-click on the resulting module to open a module editing window.
In the "module editing window", you will see three panes. The left pane shows your statements. The right pane shows your queries. The bottom pane is where you edit whatever you just clicked on.
Type "CTRL+n" to create a new statement. Enter the text "father:alfred of:bob." (remember the full-stop at the end!) and press CTRL-Enter.
Now enter the text "father:X of:Y?" (remember the question-mark!) and press CTRL-Enter.
To save your work, either export your module to a file or repository, or "Commit" the image (which will save all modules and windows in faish.im).
Now go read the documentation.
Differences from Prolog
- Faish is persistent. It currently uses Smalltalk's image persistence, but the end goal is that it resembles a logical database rather than an in-memory interpreter.
- Squl has importable modules.
- Squl is more pure. There are no cuts. "Hints" are used to determine statement evaluation order rather than depth-first search. I/O is done using external queries . A design goal of Squl is that randomly generated code can be accepted by an interpreter without harm.
- Squl is more verbose. Prolog can be very, very terse. Squl has been made more descriptive.
- Faish has a debugger. It's not great (yet), but you can at least step through your code.
- Faish crashes a lot. It's getting there though.
License
Faish is released under the MIT license. If you do anything cool with it, let me know on the mailing list! If you make bucketloads of money with it, feel free to send some my way.
Sourceforge project page