Syntax of B(PN)²

In the following passage metavariables are printed in normal font, keywords are printed bold , numeric variables are printed italic and identifiers are printed courier .

programm ::= block
block ::= begin scope end
scope ::= com | decl ; scope
decl ::= var varlist : type | const const-name = constexpr | decl ; decl
varlist ::= var-name | varlist , varlist
type ::= set | set init const | chan k of set | stack k of set
set ::= { elems }
elems ::= elems , elems | const | a..b
com ::= < expr > | com || com | com ; com | do alt-set od | do com enter alt-set od | block
alt-set ::= com ; repeat | com ; exit | alt-set [] alt-set
expr ::= 'v | v' | v | c! | c? | c!! | c?? | s! | s? | s!! | s?? | const | expr op expr | op expr | (expr)
op ::= + | - | * | / | % | = | # | < | > | < = | > = | & | | | !
const ::= false | true | z

k is a natural number.
a,b are natural numbers with a < b or ( a , b ) = ( false , true ).
z is a natural number.

In declarations, k denotes the capacity of a channel or a stack, respectively.
In commands, the brackets < ... > delineate atomic actions.
The command 'com' before the enter clause of a do command denotes initialisation; repeat clauses are repeated and exit clauses lead to termination of the do command. [] means nondeterministic choice.

v , v' , 'v
In expressions, v refers to a plain variable, c refers to a channel and s refers to a stack. `v and v' stand for the prevalue and the postvalue of v , respectively, and v stands for the prevalue of v , assuming implicitly `v = v' .

! , ?
c! and c? denote value output (input, respectively) on channel c . For example, `v = c! is true iff the prevalue of variable v and the value output on channel c are equal; thus, for instance, occam's command c!5 [?] can be modelled in B(PN)² by 5= c! .

!! , ??
c!! yields true iff c is full and c?? yields true iff c is empty. s! and s? denote value output (input, respectively) on stack s . s!! yields true iff s is full and s?? yields true iff s is empty. The expressions .!! and .?? are only defined for channels or stacks with capacity k > 0.

Stacks are analogous to channels except that they incorporate a FIFO rather than a LIFO strategy. Note that both data types can be shared between parallel components.


A comment can be placed at the end of any line. It must begin with the symbol " // " . Keywords are insensitive to upper / lower case. The following words can alternatively be used instead of the corresponding operators: parallel , choice , not , and , or , false , true .

Names of variables must be lower case if you want to compile via a PBC term.

Extension of the syntax by procedures:

scope ::= ... | proc pdecl ; scope
pdecl ::= proc-name block | proc-name (parlist) block
parlist ::= par-name : set | const par-name : set | ref par-name : set |
ref par-name : chan k of set | ref par-name : stack k of set | parlist , parlist
com ::= ... | proc-name | proc-name (arglist)
arglist ::= expr | var-name | arglist , arglist

Keywords ref and const indicate reference parameter and constant parameters, respectively; unqualified parameters are by value.

Channels and stacks must be defined by reference. Arguments for reference parameters must be plain identifiers (var-name) , arguments for value or constant parameters can also be value expressions (expr).

Names of procedures must be upper case if you want to compile via a PBC term. If you want to use constant parameters you have to check the Skip Syntax Check option, and then you can invoke first the B(PN)² expander and afterwards the Expanded B(PN)² -> HL Net

The keywords const , proc and ref can be typed either in upper or in lower case.