To assist the designer in making implementation choices related to the available bandwidth, a tool is required that computes the size of each message in bits. The tool has to read and interpret the format of each message to do so.
A message can best be described by giving the underlying grammar, which uses the following terminals:
A message is defined by the following grammar:
- id
- a sequence of letters of length L (1<=L<=256)
- integer
- a number between -10000 and 10000 (inclusive)
- "word"
- the literal string of characters word
Note that the message grammar is specified according to the following notational conventions:message ::= data data ::= id ":" type type ::= record | array | string | enum | range record ::= "{" data+ "}" array ::= "array" range "of" type string ::= "string" "(" integer ")" enum ::= "(" id-list ")" id-list ::= id | (id "," id-list) range ::= "[" integer ".." integer "]"
Any two tokens may be separated by an arbitrary amount of white space (blanks, tabs an newlines). White space does not occur within tokens.x y sequence: x followed by y x | y choice: x or y x+ repetition: one or more occurrences of x ( ) used for grouping
The (minimal) amount of bits needed to transmit a message can be computed using the following rules:
record : sum of the sizes of the fields
array : size of the component type, multiplied by the number of elements in the range
string : the length, multiplied by 7 bits
enum : smallest number of bits in which all id's can be distinguished
range : smallest number of bits in which all range values can be distinguished
A "id" message
requires S bits.
', where id is the identifier of the
message and S its size in bits.
3 year : [1970..2030] team : { name : string(14) members : array [1..3] of { sex : ( male, female ) name : string(20) age : [16..30] } position : [1..40] } jurynames : array [1..3] of string(20)
A "year" message requires 6 bits. A "team" message requires 539 bits. A "jurynames" message requires 420 bits.