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 }

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 term ::= constant | variable | compound \mbox{\hspace{1.5cm}\\ compound ::= name \bnfc{(} arguments \bnfc{)} | expression \\ \it arguments ::= \empty | term-list\\ expression ::= term \bnfc{+} term | ... \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 | term \bnfc{,} term-list\\ \it literal-list ::= literal | literal \bnfc{,} literal-list\\ \it clause-list ::= clause | clause \bnfc{,} 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 form ::= new-statement | request | sync \\ \it new-statement ::= \bnfc{new} \bnfc{(} descriptor allocator \bnfc{)} \\ \it descriptor ::= name | name \bnfc{(} arguments \bnfc{)} \\ \it allocator ::= empty | \bnfc{ @ } term \\ request ::= term \bnfc{!} literal | variable \bnfc{=} term \bnfc{!} literal\\ \it sync ::= variable \bnfc{?} | 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 ::= template | template : guard -> method-body \\ template ::= name | name \bnfc{(} arguments \bnfc{)} \\ \it guard ::= literal | \bnfc{(} literal-list \bnfc{)}\\ \it method-body ::= literal | \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 atom ::= predicate | predicate \bnfc{(} arguments \bnfc{)}\\ test ::= term < term | ... \\ literal :: atom | test | form | \bnfc{!} \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 fact ::= literal\bnfc{.}\\ rule ::= head \bnfc{\bnfneck} body \bnfc{.}\\ head ::= literal\\ body ::= literal | literal \bnfc{,} body\\ goal ::= \bnfc{?-} body \bnfc{.}\\ clause ::= fact | rule | goal \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 init ::= neme | name \bnfc{=} term\\ \it var-decl ::= \empty | \bnfc{var} init-list \bnfc{.}\\ \it isa-decl ::= \empty | \bnfc{isa} name-list \bnfc{.}\\ \it use-decl ::= \empty | \bnfc{use} name-list \bnfc{.}\\ \it options-decl ::= \empty | \bnfc{option} init-list \bnfc{.}\\ \it name-list ::= name | name \bnfc{,} name-list\\ \it init-list ::= init | init \bnfc{,} 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 ::= \bnfc{object}\= \it name inheritance-decl \bnfc{\{}\\ \> \it instance-decl constructor methods \bnfc{}\\ \it inheritance-decl ::= \empty | \bnfc{:} name-list\\ \it instance-decl ::= var-decl use-decl isa-decl options-decl \\ \it constructor ::= \empty | clause-list\\ \it methods ::= \empty | clause-list \end{tabbing} } $=P