Session Syntax

A session text is a set of lines usually interactively read in from the end-user. The interpreter prompts each line by the query operator (“?-“). Each line is first converted by the term syntax and then interpreted according to the session syntax. The main purpose of a session text is to answer queries against a logic program.

session	    --> { query "." }.
query --> "?-" body.

Examples:

?- X in [1,2,3].	       % is a query.
?- X^(X in [[1]], Y in X). % is a query

The interpreter will display the bindings of the query variable names upon success of a goal. If there are no interesting query variable name bindings the interpreter will display “Yes”. The interpreter will display “No” upon failure of a goal. When the interpreter detects choice points it will request the end-user for redo. The end-user can do so by entering “;” and hitting return. The end-user can also terminate the search by directly hitting return.

Upon failure of a goal, if there are no choice points or if the end-user terminates the search, the interpreter returns to its prompt. The interpreter also returns to its prompt when the goal throws an exception. Before returning to the prompt the interpreter will first display the message and the stack trace of the exception. By entering queries that consult theory texts or update database predicates, the knowledgebase  will be modified and thus further invocations of queries will return different solutions.

Comments