An overview of the syntax and the informal semantics of DLP
is given in section \ref{des/dlp} and table \ref{des/dlp:DLP}.
For clarity we will here provide a more detailed description
of the syntax of DLP by means of BNF-grammar rules.
.so DLP
Keywords
\dlpindex{keywords}
The following keywords are used in DLP:
{\small
- object --- to start an object declaration,
- var --- to declare non-logical variables,
- use --- to indicate the inheritance of clauses,
- isa --- to inherit non-logical variables,
- new --- to create new objects,
- accept --- to indicate the willingness to engage in a rendez-vous,
- deterministic --- to disallow backtracking over answers,
}
BNF grammar rules
\dlpindex{BNF grammar rules}
The rules describing the syntax of DLP programs are quite similar to those for
Prolog programs as given in section \ref{Prolog:BNF}.
In addition we have rules describing
object declarations and the special forms
by which DLP extends Prolog.\ftn{
As before, terminal symbols are written bold-face.
}
DLP is term-oriented.
A term is either a constant, a variable or a compound term.
We distinguish between compound terms that are constructed from a function symbol name and
a possibly empty list of argument terms, and expressions built from an (arithmetical)
operator and one or two sub-terms.\ftn{
A name is a special constant, namely a sequence starting with a lower case letter
followed by an arbitrary number of letters or digits.
}
\gprog{term}{
\begin{tabbing} \small \it
\\
\\
\it term-list\\
\end{tabbing}
}
Given a syntactical unit we define a list of such units as consisting of
one such item possibly followed by other items, separated from each other by a comma.
In such a fashion we define lists of terms, literals and clauses.
\gprog{list}{
\begin{tabbing}
\it term-list term-list\\
\it literal-list literal-list\\
\it clause-list clause-list
\end{tabbing}
}
Among the special forms by which DLP extends Prolog is a new-statement.
The objects created are passive or active dependent on the descriptor
given to the new-statement.
Both passive and active objects may be allocated to a particular processor.
The other forms provide
statements to request the (remote) evaluation of a goal and statements
to synchronize the acceptance of a method call and the communication of the results of
accepted method calls.
\gprog{form}{
\begin{tabbing} \small \it
new-statement \\
\it new-statement descriptor allocator \bnfc{)} \\
\it \\
\it allocator \bnfc{ @ } term \\
\\
\it accept-statement
\end{tabbing}
}
For an active object, acceptance of a method call is determined by the occurrence of either
a template as an argument of the accept statement or an accept-expression.
An accept-expression is built from a template, a guard and a method-body
that is evaluated when the guard succeeds.
\gprog{acceptance}{
\begin{tabbing} \small \it
\it accept-expr method-body \\
\\
\it \bnfc{(} literal-list \bnfc{)}\\
\it method-body \bnfc{(} literal-list \bnfc{)}\\
\it acceptance-list accept-expr accept-expr \bnfc{,} acceptance-list\\
\it accept-statement \bnfc{accept} \bnfc{(} acceptance-list \bnfc{)}
\end{tabbing}
}
An atom is a predicate with or without arguments.
Syntactically, a predicate without arguments conforms to the constraints imposed on names.
A test is a predicate-expression involving an arithmetical comparison operator.
A literal is either an atom, a test, a special form or a cut
(written as an exclamation mark).
\gprog{literal}{
\begin{tabbing} \small \it
\\
\\
\end{tabbing}
}
A clause is either a fact, a rule or a goal.
A fact is a rule without a body and is written as an atom followed
by a dot.
The head of a rule is an atom and the body of a rule is a list
of literals.
A goal is also a list of literals, just as the body of a rule.
\gprog{clause}{
\begin{tabbing} \small
\\
\\
\\
\\
\\
\end{tabbing}
}
When declaring the non-logical variables of an object, these may be given an initial
value.
Such an initialization takes the form of an equation with the name of the variable on the left-hand
side and the initializing value on the right-hand side.
An objectdeclaration may also specify the objects from which non-logical variables or clauses are
inherited.
\gprog{declarations}{
\begin{tabbing} \small \it
\it \\
\it var-decl init-list \\
\it isa-decl name-list \\
\it use-decl name-list \\
\it options-decl init-list \\
\it name-list name-list\\
\it init-list init-list
\end{tabbing}
}
An object declaration may specify from which objects it inherits non-logical variables and clauses.
Further it may specify the non-logical variables of the objects,
additional inheritance information, and clauses embodying the constructor and the methods
that the object supports.
\gprog{object}{
\begin{tabbing} \small \it
\it object-decl \= \it name inheritance-decl \\
\> \it instance-decl constructor methods \\
\it inheritance-decl name-list\\
\it instance-decl var-decl use-decl isa-decl options-decl \\
\it constructor clause-list\\
\it methods clause-list
\end{tabbing}
}
$=P