Rapide Tutorial Syntax Summary
|
|
Architecture
architecture_declaration ::=
architecture identifier `(' [ parameter_list ] `)'
[ return interface_expression
]
is
[ module_constituent_list ]
[ connect { connection }
]
end [ architecture ] [ identifier
] `;'
connection ::=
pattern connector pattern `;'
| other kinds of pattern connections ...
connector ::= `to' | `=>' | `||>'
Interface
The interface type of a component consists of the set of constituents
by which the component communicates with other components. An
interface type has seven kinds of declarative regions --
a provides part,
a requires part,
an action part,
a private part,
a service part,
a constraint part and
a behavior part.
Declarations may be names of types, names of modules or names of
functions, and they associate a type with the identifier, but do not give
an implementation.
Interface types are declared using the following syntax:
type_declaration ::=
type identifier is interface_expression `;'
interface_type_expression ::=
interface { interface_constituent }
[ behavior behavior_declaration ]
end [ interface ] [ identifier ]
interface_constituent ::=
provides { interface_declarative_item
}
| requires { interface_declarative_item }
| action { action_name_declaration }
| private { interface_declarative_item }
| service { service_declarative_item }
| constraint { pattern_constraint_list}
Actions and Functions
action_name_declaration ::=
action mode identifier
`(' [ formal_parameter_list ] `)' `;'
mode ::= in | out
function_name_declaration ::=
function identifier
`(' [ formal_parameter_list ] `)'
[ return type_expression ] `;'
For example,
action in Write(value : Data);
function Read() return Data;
Services
service_declaration_item ::=
basic_name_list `:' [ dual ] interface_type_expression
`;'
Consider,
type Resource is
interface service DO : Data_Object_TC(Integer);
end interface Resource;
The DO service in the Resource interface denotes all of the actions,
functions and nested services (if any) constructed from applying
Integer to the Data_Object_TC type constructor. To name them, the name
``DO'' is appended with the usual ``.'' notation before
the name of the constituent. If the service were dual, the same constituents
would be denoted except that the modes of the service's
constituents are reversed; provides (requires) functions become requires
(provides) functions, and in (out) actions become out (in)
actions.
Procedural Statements
-
Conditional:
if expression then
statement list
[ elsif expression then statement
list ]
[ else statement list ]
endif;
-
Do
This statement is a generalized form of an iterator and code block.
its exact syntax can be looked up in section 5.3 of
Executable LRM
an example of its use itaken from it is:
declare C : Ref(Character) is Ref_To(Characted, '
');
do
C := Read_Character();
exit where $C = '*';
end do;
C is a reference to a character. The declaration of C is elaborated
only once, regardless of how many interations of the loop actyually
take place. The scope of C is the body of the do statement. Execution of
the do statement completer when the exit statement forces completion of
the loop.
-
Exit: Serves to complete the execution of an enclosing loop statement,
as illustrated in the previous paragraph. The completion may be canditional
to an expression included in the statment, its syntax is:
exit [ do name ][where condition];
-
Next: Serves to complete the execution of the current iteration of the
enclosing loop, also opeitonally subject to a conditional expression.
next [ do name ][where condition];
-
Case:
-
Return
-
Await
-
Assert
-
Null
-
Functions Call
-
Raise
Reactive statements
The await statement
await_stmt :=
await
pattern [
'=>' stmt_list
[ pattern_choices ]
[ else_part ]
end [ await
] [ identifier ] ]';'
pattern_choices :=
pattern_choice [ or pattern_choice
]
pattern_choice :=
pattern '=>' stmt_list
else_part :=
else stmt_list
The when statement
when_stmt :=
[ declare declaration_list ]
when pattern [ declare declaration_list
]
do
stmt_list
[ handler
handler_list ]
end when ';'
General Reactive Rule Form
rule := [ placeholder_declaration_list ] pattern op body';'
op := '=>' | '||>'
Module Generator
module generator :=
module identifier '(' [ parameter_list
] ')'
[ return interface_expression ] is
[ module_declaration_list
]
[ constraint
module_pattern_constraint_list ]
[ connect module_connection_list
]
[ initial module_statement_list
]
[ ( parallel |
serial ) process '||' process ]
[ final module_statement_list
]
end [ module ][ identifier
]';'
Constraints
pattern_constraint := [ label ] ( match | never
) pattern ';'
Maps
map_generator :=
map identifier '(' [ formal_parameter_list
] ')'
from domain_list to range is
{
declaration }
[ constraint { constraint } ]
rule { agent_state_transition_rule
}
end [ map ] [ name ] ';'
agent_state_transition_rule := pattern '||>' { state_assignment
} [ poset_generator ] ';'