This page summarizes the main components of the MPD language and gives their syntactic forms. Plurals and ellipses are used to indicate zero or more occurrences of items. Many items are optional. Items within resources, globals, and blocks can appear in any order.
Semicolons can be used -- as in C or Java -- to terminate declarations, statements, or expressions. However, they are optional in MPD in the sense that they can always be replaced by newline characters.
MPD provides two kinds of comments. A one-line comment begins with the sharp symbol # and ends at the next newline character. Bracketed comments are like those in C: they begin with /* and end with the corresponding occurrence of */. Bracketed comments can span multiple lines and can be nested.
resource identifier # general combined spec and body
import or extend component_identifiers
constant, type, or operation declarations
body identifier(parameters)
import component_identifiers
declarations and statements
procs, procedures, and processes
final { block }
end identifier
resource identifier(parameters) # simple combined spec and body
resource body portion
end identifier
resource identifier # abstract spec
resource spec portion
end identifier
resource identifier # separate concrete spec
resource spec portion
body identifier(parameters) separate
body identifier # separate body
resource body portion
end identifier
global identifier # combined spec and body
import component_identifiers
constant, type, variable, or operation declarations
body identifier
import component_identifiers
declarations and statements
procs, procedures, and processes
final { block }
end identifier
global identifier # spec only; no body
global spec portion
end identifier
global identifier # separate spec
global spec portion
body identifier separate
body identifier # separate body
global body portion
end identifier
proc identifier(formal_identifiers) returns result_id {
block
}
procedure identifier(parameters) returns type result_id {
block
}
process identifier {
block
}
process identifier[quantifiers] {
block
}
Blocks contain declarations and statements (in any order).
Formal parameter declarations are like variable declarations without initialization expressions. Parameter declarations are separated by commas.
bool # basic types
int
char
real or double
string[maximum_length]
file
enum(enumeration_literals) # user-defined types
rec(field_definitions)
union(field_definitions)
ptr type_definition, or ptr any
cap resource_id, cap vm, cap operation_id, cap sem, cap optype_id,
cap operation_specification
[ranges] type_definition
type identifier = type_definition
const type identifier[subscripts] = expression
type identifier[subscripts] = expression, ...
op identifier[subscripts] (parameters) returns type result_id {op_restriction}
op optype_identifier identifier[subscripts]
sem identifier[subscripts] = expression
external identifier(parameters) returns type
optype identifier = (parameters) returns type result_id (op_restriction)
An operation restriction is {call}, {send}, or {call, send}.
bound_variable = start to finish by step st boolean_expr bound_variable = start downto finish by step st boolean_expr
variable = expression variable += expression # also -=, *=, ... variable++ variable-- ++variable --variable variable :=: variable # swap statement
expression
skip
stop (expression) # halt program execution
if (boolean_expression) { block } # the braces are required
if (boolean_expression) { block } # again, the braces are required
else if (boolean_expression) { block }
...
else { block }
while (boolean_expression) { block } # the braces are required
for [quantifiers] { block } # the braces are required
exit # break out of enclosing while or for statement
next # continue with next execution of enclosing loop
begin { block } # the braces are required
call operation(actuals)
send operation(actuals)
fork operation(actuals) # means same thing as send
forward operation(actuals)
receive operation(variables)
in [quantifier] operation_id(formal_identifiers)
st synchronization_expr by scheduling_expr -> block
[] ...
[] else -> block
ni
V(semaphore)
P(semaphore)
return
reply
resource_capability = create resource_id(actuals) on vm_capability
vm_capability = create vm() on physical_machine
destroy(capability)
co [quantifiers] invocation -> block // ... oc
and any begin body bool by call cap char co const create destroy double downto else end enum exit extend external false file final for fork forward global high if import in int low mod new next ni noop not null oc on op optype or P proc procedure process ptr real rec receive ref reply res resource return returns sem send separate skip st stderr stdin stdout stop string to true type union V val var vm while xor