GOAL uses a knowledge representation (KR) language for representing the cognitive state of an agent. That is, a KR language is used for representing an agent's percepts, knowledge, beliefs, goals, and messages. KR languages are also used for representing pre- and post-conditions of actions and the arguments of several built-in actions such as the insert action. Embedding knowledge representation languages within an agent programming language poses several challenges:
- How to adapt the notation of the agent programming language to the style of the embedded KR language? In particular, how to adapt tokens used in the agent programming language and use the same tokens for similar symbols in both the agent programming language as well as the KR language.
- How to delimit the scope of the KR language fragments within the context of language elements available in the agent programming language?
Adapting the Style of the Language to the KR Language
The motivation for the first bullet point above is that it seems more natural for a user (programmer) to use notation that he or she is already familiar with, assuming familiarity with the KR language that is being used. For example, it is more natural if the same symbol for combining cognitive state conditions in a conjunction can be used as the symbol used for conjunction in the KR language. For example, if Prolog is used as KR language we'd like to use the comma , for combining cognitive state atoms into a conjunction and if PDDL is used as KR language we'd like to use the
and operator used in that language. More specifically, we'd like to adapt the following symbols in the agent programming language GOAL:
- The conjunction token: e.g. Prolog uses '
,'; PDDL uses '
- The negation token: e.g. Prolog uses '
not' (and '
\='); PDDL uses '
not'; other languages might use, e.g. '
- Variable identifiers: e.g. Prolog uses capital letters; PDDL uses a leading '
?' to signal variables.
- The comment token: SWI Prolog uses '
%' for line comments and '
/*' and '
*/' for block comments, PDDL uses '
Comments are typically used in two different modes: line comments that consume all characters that follow till the end of the line, and block comments which consist of comment text that may be distributed over multiple lines. Many languages use different notation for comments.
Perhaps it would be useful to also allow a user to adapt these tokens to its own preferred style, but doing so would likely also decrease the readability of an agent program for other developers.
Embedding KR Fragments into the Agent Language
The motivation for the second bullet point is that we would like to use simple, familiar, and well-known punctuation symbols like brackets '
(' and '
)' to surround the operands of operators such as
bel rather than have to resort to idiosyncratic notations such as, e.g., '
#(' and '
#)'. We'd like to write
bel(location(X,Y)), for example, where the
bel operator indicates that the Prolog fragment
location(X,Y) is a belief of the agent.
In line with the discussion above, a bigger challenge is to adapt the style of embedding KR fragments to the style used in the KR language. A key difference in style between Prolog and PDDL , for example, is the style of operator use and the associated use of brackets. Prolog uses infix notation and a conjunction is written as
firstConjunct, secondConjunct whereas PDDL uses prefix notation and the same conjunction would be written as
(and firstConjunct secondConjunct). It is a challenge to realize this kind of style adaptation.