Course:CPSC312-2016-Project1-PrologLinter

From UBC Wiki

Title

Authors: Graham Brown, Tyler Young, Yasmeen Akbari

What is the problem?

Loading the prolog interpreter, only to find out we made a typo, is terribly annoying. Therefore we will create a logically based swi-prolog syntax checker which will check our prolog syntax through an exterior prolog program. We will follow the context-free grammar (CFG) of ISO/IEC 13211-1, Prolog Part 1, General Core, Chapter 6: Syntax. Prolog's robust parsing ability will tokenise the given program, and then be checked using rules derived from our CFG. As our class is using swi-prolog, we will follow any SWI deviations from the ISO standard.

Resources

Examples of parsing for a CFG:

Example of using a CFG with English:

Syntactical Tokens to Cover

As prolog has many nuances that would take too long to cover, we will implement the following:

  • Directives
  • Clauses
  • Data
  • Atomic Terms
  • Variables
  • Compound Terms
    • Arguments
    • Operators
    • Operators as Functions

What is the something extra?

In addition to the above syntactic tokens, we intend to include syntax checking for our in-lecture definition of difference lists and difference list operations. If time permits, we can include more advanced syntactic functionality.

Additional Operations
  • makelist(DL,L) means L is the list represented by decision list DL
  • addtofront(E, D1, D2) D2 is the result of adding E to the front of D1
  • addtoend(E, D1, D2) D2 is the result of adding E to the end of D1
  • dlappend(D1,D2,D3) D3 contains the elements of D1 followed by the elements of D2

What did we learn from doing this?

(This should be written after you have done the work.) What is the bottom-line? Is logic programming suitable for (part-of) the task? Make sure you include the evidence for your claims.