Skip to content

HeavyHelium/python-course-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swish Bish Prolog

The project consists of an interpreter and an accompanying editor built with tkinter.

How to run

  • Install dependencies
pip install -r requirements.txt
  • To start the editor
python editor.py
  • To run the tests
pytest tests

Project Overview

Intepreter

The programming language is a subset of pure prolog.

  • The prolog interpreter implements an SLD resolution scheme(unification + backtracking).

  • Negation as failure is also supported.

Sample programs can be found in the sample folder.

Examples

Given the clauses in the family_relations.pl program in the sample folder, here are some sample queries:

ancestor(X, Y).
ancestor(hamish, anne).
ancestor(hamish, 'anne').
ancestor(hamish, 'rosie').
sibling(X, Y).
not(ancestor(hamish, jack)).

Editor features

File menu

Includes the standard operations new,open, save, save as, exit.

Preferences menu

  • Font
    The user can set the font family and size

  • Mode
    There are 3 modes to choose from:

    • Dark
    • Light
    • Swish Bish

Other features

  • Line-number bar
  • Key-bindings
    • for saving <Control-s>
    • for running the current program, with respect to the current query <Control-Return>

Future improvements

  • list support
  • more informative error messages
  • arithmetics
  • unification over infinite trees

About

final project for the python course @fmi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages