APPENDIX A - SYNTAX OF THE STATE MANAGER LANGUAGE

The syntax is described in BNF form with the following formalism:

Terminals are the basic symbols from which a program is formed: languages keywords, operators... They are written in upper case.The following punctuation marks are terminals of the SMI language: colon ":", double colon "::", comma ",", parenthesis "()", equal "=" and quotes """. Non-terminals are syntactic variables that define sets of strings. They give a hierarchical structure to the language, which is useful for the translation. The notation used is lower case words between "<" and ">".

Each production rule consists of a non-terminal followed by "::=" followed by a string of terminals and nonterminals. The syntax of a program is correct if it can be obtained by the use of the production rules from the nonterminal start symbol : "<program>". The braces "{}*"denote the repetition zero or more times of the enclosed items and "{}+" at least once. The square parenthesis "[]" are used for optional terminals or nonterminals in production rules.

The vertical bar "|" is used for a choice between different terminals or nonterminals.

 

Definition of a SMI program

<program> ::= { <class def> | <object_def> }+

 

Definition of a class

<class def> ::= <class decl> { <logical object descr> | <associated class spec> }

<associated class spec> ::= { /ASSOCIATED <associated object descr> }

 

Definition of an object

<object def> ::= <internal object def> | <external object def>

<internal object def> ::= <internal object decl> { <logical object spec> | <associated object spec> }

<external object def> ::= <external object decl> | <associated object spec>

<logical object spec> ::= { <reference to a class> | <logical object descr> }

<associated object spec> ::= <reference to a class> | { /ASSOCIATED <associated object descr> }

<reference to a class> ::= IS_OF_CLASS <class identifier>

Description of an object

<logical object descr> ::= { <logical state def> }+

<associated object descr> ::= {<associated subobject def> }+ | {<associated state def> }+

 

Definition of a sub-object

<associated subobject def ::= <subobject decl> { <associated state def>}+

 

Definition of a state

<logical state def> ::= <state decl> [/INITIAL_STATE] { <when instructions> }* { <logical action def>}+

<associated state def> ::= <state decl> [/DEAD_STATE] { <action_decl> }*

 

Definition of an action

<logical action def ::= <action decl> { <standard instruction> }*

 

Definition of an instruction

<when instruction> ::= WHEN <condition> DO <action identifier>

<standard instruction> ::= <do instruction> | IF <condition> THEN { <standard instruction> }* [ ELSE { <standard instruction> }* ] ENDIF

<do instruction> ::= DO <action identifier> [ ( {<parameter>}+ {, <parameter> }* ) ] <object reference>

 

Logical expression

<condition> ::= {<factor> { { AND <factor> } | { OR <factor> } }*

<factor> ::= [NOT] <term>

<term> ::= { <object reference> [ . <subobject identifier> ] { IN_STATE | NOT_IN_STATE } <state list> } | { ( <condition> ) }

 

Declarations

<class decl> ::= CLASS: <class identifier>

<internal object decl> ::= OBJECT: <object identifier>

<external object decl> ::= OBJECT: <domain identifier> :: <object identifier>

<subobject decl> ::= SUBOBJECT: <subobject identifier>

<state decl> ::= STATE: <state identifier>

<action decl> ::= ACTION: <action identifier> [ ( {<parameter decl>}+ {, <parameter decl> }* ) ]

<parameter decl> ::= <formal parameter identifier> [ = <string literal> ]

 

Syntactic elements

<state list> ::= <state identifier> | { <left curly bracket> <state identifier> { , <state_identifier> }* <right curly bracket> }

<parameter> ::= <parameter identifier> = { <formal parameter identifier> | <stringliteral> }+

 

<object reference> ::= [<domain identifier> :: ] <object identifier>

<identifier> ::= <alpha> {[ _ ] | <alphanumeric> }*

<string literal ::= " {all characters except " }* "

<integer> ::= <digit> {<digit>}*

<alphanumeric> ::= <digit> | <alpha>

<digit> ::= 0|1|2|3|4|5|6|7|8|9

<alpha> ::= A| B| C| D| E| F| G| H| I| J| K| L| M| N| O| P| Q| R| S| T| U| V| W| X| Y| Z| a| b| c| d| e| f| g| h| i| j| k| l| m| n| o| p| q| r| s| t| u| v| w| x| y| z

<left curly bracket> ::= {

<right curly bracket> ::= }

<comment> ::= ! {all characters }*