Definition Packages

Definition packages are used to define a set of related types and constants of the data to be processed by the agents and passed between them. A definition package is compilation unit to generate internal representation of the data type declarations and constant declarations and checking for type correctness in the definitions. However, no object code will be generated for deployed and instantiated, nor to be executed. They are used in type checking across different castes.

The syntax of definition packages in EBNF follows.

DefPackage ::=

[ Imports ] ⟨DEFINITION⟩ PackageName=Identifier "{" Definitions "}"

Imports ::=⟨IMPORT⟩ PackageName { "," PackageName } ";"

Definitions ::={ TypeDef | ConstDef }+

A definition package may depends on a number of existing other definition packages. The Imports clause starts with the key word import, and then lists the identities of such packages. The body of a definition package consists of a series of one or more declarations of data types and constants.

The following are two examples of definition packages.

DEFINITION DateTypes {

TYPE WeekDays = ENUM:{Mon, Tue, Wed, Thur, Fri, Sat, Sun};

TYPE Months = ENUM:{Jan, Feb, Mar, Apr, May, Jun,

Jul, Aug, Sept, Oct, Nov, Dec };

TYPE Date = STRUCT{

day:INTEGER;

month:Months;

year:INTEGER};

}


IMPORT DateTypes;

DEFINITION PersonalTypes {

TYPE Person = STRUCT{

name:STRING;

DateOfBirth:Date

};

}