The PRISM Language /

Modules And Variables

The previous example uses two modules, M1 and M2, one representing each process. A module is specified as:

module name ... endmodule

The definition of a module contains two parts: its variables and its guards. In this example, each module has one integer variable with range [0..2]. A variable declaration looks like:

x : [0..2] init 0;

Notice that the initial value of the variable is also specified. See the next subsection for more information about this subject. Boolean variables can also be used, e.g.:

b : bool init false;

The names given to modules and variables are referred to as identifiers. Identifiers can be made up of letters, digits and the underscore character, but cannot begin with a digit, i.e. they must satisfy the regular expression [A-Za-z_][A-Za-z0-9_]*, and are case-sensitive. Furthermore, identifiers cannot be any of the following, which are all reserved keywords in PRISM: A, bool, const, ctmc, C, double, dtmc, E, endinit, endmodule, endrewards, endsystem, false, formula, func, F, global, G, init, I, int, label, max, mdp, min, module, X, nondeterministic, Pmax, Pmin, P, probabilistic, prob, rate, rewards, Rmax, Rmin, R, S, stochastic, system, true, U, W,

PRISM Manual

The PRISM Language

[ View all ]