JADL grammar in EBNF


General

multi_line_doc = /** [[0..65535]-*]* *+ ([[0..65535]-[* + /]] [[0..65535]-*]* *+)* /
free_identifier = act | goal | user | provider | role | service | data | log | end | constr | add | remove | update | use | ontology | identifier
single_objref = identifier Name
identifier = Word

jadlfile = multi_line_doc? ( package Name file? declaration* elements* ) | declaration* goal
file = multi_line_doc? ( file identifier )

declaration =

( include Name )|
( ont Name ) | // for compatibility only
( import Name :? identifier* ) | // used for java-imports too
( incl Name* ) | // for compatibility only
#import free_identifier | // for compatibility only
multi_line_doc? ( objref single_objref+ ) |
( use Path )

elements =

ontology |
action |
conditional |
sendspeechact |
receivespeechact |
factdef |
ruledef |
goal

term = value | varname | refname | ( cast term type ) | ( fun Name term* ) | ( comp Name term* )
varname = ?Name
refname = identifier
collection = [] collection? | {} collection?
type = bool collection? | int collection? | real collection? | string collection? | url collection? | agentname collection? | timestamp collection? | abstract collection? | class collection? : Name []* | Name collection?

value =

( newobj Name attribute_term* ) |
( obj Name attribute_term* ) | // for compatibility only
[ type : term* ] | // either allow fully qalified names or no ':'
{ type : term* } | // either allow fully qalified names or no ':'
Constant

attribute_term = ( Name term )

var_decl_list = ( var var_decl+ )
var_decl = varname : type var_init_value?
var_init_value = = value

integer = -? number

Formula

formula = conjunctive | disjunction
conjunctive = conjunction | literal
disjunction = ( or conjunctive+ )
conjunction = ( and literal+ )
literal = ( not literal ) | ( basicliteral ) | truth
basicliteral = atomicformula | quantorexpr
atomicformula =
obj (varname | refname) Name attribute_term* |
att Name term term |
comp Name term* |
known var_decl_list? conjunctive |
unknown var_decl_list? ( atomicformula )

quantorexpr = forall term var_decl_list conjunctive | exists term var_decl_list conjunctive
truth = true | false | unknown

Ontologies

ontology = multi_line_doc? ( ontology identifier declaration* constant_decl* category_decl* function_decl* )
constant_decl = ( const identifier Type constant )
category_decl = multi_line_doc? ( cat identifier extensions? attribute* )
extensions = ( ext identifier* )
attribute = ( free_identifier type keyword* )

keyword =

fixed |
needed |
defined |
private |
( init term ) |
( default term ) |
( constr var_decl_list? formula )

function_decl =

multi_line_doc? ( fun type free_identifier type* ) javacode |
multi_line_doc? ( fun type free_identifier type* javacode ) |
multi_line_doc? ( comp free_identifier type* ) javacode |
multi_line_doc? ( comp free_identifier type* javacode )

javacode = Javaline+ | Javablock

Content

action = multi_line_doc? ( act identifier var_decl_list? protocol_decl? precondition execcondition? effect+ execution ) metatag?

protocol_decl =

( prot Name identifier prot_role var_decl_list? ) | // for compatibility only
( prot identifier servicename prot_role var_decl_list? ) |
( mprot Name identifier user var_decl_list? ) | // for compatibility only
( mprot identifier servicename user var_decl_list? )

servicename = ( service identifier )
prot_role = user | provider
precondition = ( pre formula )
execcondition = ( cond conjunctive ) | ( exec conjunctive )
effect = ( eff conjunctive )

execution =

inference |
abstract |
( abstract ( provider term )) |
( primitive Name integer term* ) |
( primitive Name Name term* ) |
( call Name integer term* ) | // for compatibility only
( service value provider_selection? ) |
( script var_decl_list? scriptbody )

provider_selection = ( provider term* )
conditional = multi_line_doc? ( cond identifier var_decl_list? cond_case+ ) metatag?
cond_case = ( case integer : formula ) | formula
sendspeechact = multi_line_doc? ( send identifier var_decl_list? replytags? speechact ) metatag?
receivespeechact = multi_line_doc? ( receive identifier var_decl_list? replytags? speechact+ ) metatag?
replytags = ( replytags replytag_tuple+ )
replytag_tuple = ( identifier term )
speechact = free_identifier | ( free_identifier definitions* content+ )
definitions = ( def value )

content =

( act term ) |
( par term+ ) |
( inf formula ) |
( data term+ ) |
( cond formula ) |
( reason integer term* )

factdef = multi_line_doc? ( fact identifier? objectdef ) metatag? | multi_line_doc? ( obj identifier? objectdef ) metatag?
ruledef = multi_line_doc? ( rule identifier var_decl_list? formula rule_action ) metatag?
rule_action = ( goal? rule_case* ) | rule_case* | ( role Name rule_case* ) | Name rule_case*
rule_case = ( true conjunctive ) | ( false conjunctive ) | ( true integer ) | ( false integer )
goal = multi_line_doc? ( goal var_decl_list? conjunctive ) metatag?
metatag = :( meta meta_tuple+ )
meta_tuple = ( identifier term )

Scripts

scriptroot =
( seq scriptbody+ ) |
( par scriptbody+ ) |
( alt scriptbody+ ) |
( iseq term var_decl_list scriptroot ) |
( ipar term var_decl_list scriptroot ) |
( ialt term var_decl_list scriptroot ) |
( mseq scriptroot ) |
( mpar scriptroot ) |
( malt scriptroot )

scriptbody =
scriptroot |
planelementcall |
fail |
end |
break |
cont |
( bind var_name term ) |
( unbind var_name ) |
( add term term? ) |
( remove term ) |
( eval conjunctive ) |
( update conjunctive ) |
( branch planelementcall branchcase+ ) |
( branch planelementcall scriptbody+ ) | // for compatibility only
( loop planelementcall branchcase+ ) |
( loop planelementcall scriptbody+ ) | // for compatibility only
( logerror term term? ) |
( logwarn term term? ) |
( loginfo term term? ) |
( logdebug term term? ) |
( log term term? ) |
( goal conjunctive ) metatag? |
( fbget var_name conjunctive ) |
( fbgetall var_name var_decl_list conjunctive )

branchcase = ( case : integer scriptbody )
planelementcall = ( call Name pe_call_args? ) | ( identifier pe_call_args? ) // for compatibility only
pe_call_args = ( var P.term+ )