Logo BCDDLogo CSC
BCDDBehavioural Contract-Driven Design
version 1.0-beta
ITEN

2. The words of the file

The text is divided into tokens, like the words of a sentence. Spaces separate the tokens and have no other effect: alignment in columns is free.

2.1 Notation of the rules

The rules are written in EBNF notation (Extended Backus-Naur Form), which reads as follows:

Notation Meaning
A = B C ; A is made of B followed by C
"CSC" the word to be written exactly so, with the same upper case
[ x ] x can be omitted
{ x } x zero, one or more times
x | y x or y
( … ) groups

2.2 Rules of the words

No. Rule Example
L1 Comment: from -- to the end of the line, if -- is not inside a string. The comment does not count EVENT IN arrivo -- from the button
L2 String (Stringa): from " to the next ". It can contain line breaks and run over several lines. It has no escape sequences: a string cannot contain ". Inside a string nothing is a keyword and nothing is a comment "A press switches on the light"
L3 Word: it begins with a letter (of any alphabet, accented included) or with _; it continues with letters, diacritical marks, digits from 0 to 9, _, and with - only if it stands between two of these characters intensità, g-n1, ATTESA_MAX_LLM
L4 Dotted number: an optional -, attached to the first digit; then digits from 0 to 9, possibly divided by dots, each between two digits. The - belongs to the number only if the character before it is not a letter, a diacritical mark, a digit or _ (otherwise L3 applies: g-1 remains a word) and if it is not the start of -- (comment, L1) 180, 0.5, 0.1.2, -20.0, -40
L5 Symbols: := .. ( ) , : = [ ] @ . { }, and the symbols of formulas < <= > >= <> + - * / ^ -> ;. The longest symbol is always taken: :=, .., <=, >=, <> and -> are a single symbol; . is a single symbol when it is not followed by another . and is not inside a dotted number (L4). The - is the minus sign only when it is not the start of a comment (L1), does not stand inside a word (L3), does not belong to a number (L4) and is not the start of -> DEFINE D := 3, Sessione.pronta, {L, R}, a - b, x <= 1.0
L6 Foreign character: every other character outside strings and comments (for example →, ±, ≤, $, %). It is not an error: it makes the declaration that contains it unrecognised ±, →

Reading examples. g-1 is a word (L3); --20 is a comment (L1); in x=-3 after = there is the number -3, because = is not a letter; - 3 is the minus sign and then the number 3; a - b is the word a, the minus sign and the word b, whereas a-b is a single word (L3) and a -3 is the word a followed by the number -3, with no symbol between the two; 5-3 is the number 5, the minus sign and the number 3, because the - after a digit does not belong to the number (L4); -x is the minus sign and the word x; A->B is A, -> and B; 0.5 is a number; a.b is three tokens (a, ., b); Sessione . pronta is the same three tokens as Sessione.pronta, because spaces do not count; x.5 is three tokens (x, ., 5) that no rule accepts. To read a minus between two values without doubt, it is written separated from both: a - b, x - 3.

Letters are compared as they are written: città written with the precomposed “à” and città written with “a” plus a separate accent are two different names. Upper and lower case matter: Check and check are different names, and guarantee is not the keyword GUARANTEE.

2.3 Keywords and reserved words

The keywords are in English. They are the words that bcdd reads, divided here by use.

The words of the CSC, of the entity, of the blocks and of the header:

CSC VERSION END STATUS HYPOTHESIS RATIFIED BY PURPOSE CAPABILITY AUTONOMOUS
EVENT IN OUT STATE INITIAL DEFINE UNDECIDED GUARANTEE ASSUME DETAILS VERBAL VERIFY
JUDGEMENT INSPECTION SCENARIO GIVEN EXPECT ADMITTED REJECTED COMPOSED OF
TYPE ENTITY OFFERS USES VARIANT
IMPORT PROFILE BINDING VERIFICATION EXTENSION

the words of formulas and of scenarios (sections 4.6 and 4.12), with the type Record (section 4.4):

WHILE ALWAYS EVENTUALLY WHENEVER THEN WITHIN AT ONCE REPEAT FOREVER EVERY
AND OR NOT IMPLIES IF ELSE COUNT LAST TIME SINCE PREV WITH ABSENT PRESENT Record

the words of the shorthands and the mathematical functions (section 4.12):

NEVER AFTER BEFORE BETWEEN UNTIL PRECEDES FOR LEAST ACCEPTS ONLY REQUIRES ENSURES RESOLVES
CHANGED TRANSITION ON WHEN FOLLOWS ALL
ABS MIN MAX LOG10 ROUND FLOOR CEIL

the fields of an extension, the values of the KIND field and the categories of parameters (section 4.11):

KIND LEVEL PARAMS FORM MEANING REDUCES TO SOURCE
PATTERN SCOPE FUNCTION DECLARATION RELATION SCENARIO-FORM
Name Type Event Condition Expression Duration Property

the words of the concrete forms and of the verification plan (section 4.11):

BIND AS MEANS OBSERVES RESOLUTION USING TRANSLATES

The values of the LEVEL field (CSC, ENTITY, BINDING, VERIFICATION) are already keywords. Duration is also the name of a base type (section 4.4) and, in the PARAMS field, the category with the same meaning. SCENARIO-FORM is a single word (L3) with a -: it could not be written as a Nome in any case (L7); the reservation also excludes the short name SCENARIO-FORM (L8).

The words of two forms planned for future developments of the language are reserved; bcdd does not recognise them in any declaration (REFINED BY, which will state on which guarantees of the parts an entity guarantee rests, and REFINES, the relation between two versions of a CSC):

REFINED REFINES

The following are reserved because they have been withdrawn from the language:

FACE LINK MAP REFINEMENT VIEW

The following are also reserved, in lower case: true false requested accepted rejected completed failed _.

In all, the keywords and reserved words number 136.

A keyword or reserved word cannot be a name. A line that uses one as a name is not recognised. The exceptions are the declarations that begin with REFINEMENT: they are error E15 (section 4.8).

A single list. The keywords and reserved words of this section are the same for check, new (rule L7, section 11), ratify (short name and name after --csc, section 12.5) and refine (names and short names of the proposals): no command has a list of its own.

What is not reserved, and why:

Why the words that the program reads in one place only are also reserved. A request named ENSURES or a state named LEVEL would give the same word two meanings in the same file. The lower case remains free (section 2.2): pattern and level are valid names.

Why FACE, LINK, MAP, REFINEMENT and VIEW remain reserved. They are forms withdrawn from the language, replaced by CSCs and entities. They remain reserved to avoid confusion: whoever knows the withdrawn forms reads them with the old meaning, and a free name MAP in a CSC would look like the withdrawn relation MAP. A withdrawn word remains reserved for ever: freeing it would bring no advantage, and it could no longer be reserved again without invalidating CSCs.

2.4 Names

No. Rule Valid example Invalid example
L7 Nome (name) = a word without -, which is not reserved pressione, Città, ATTESA_MAX_LLM g-n1 (has -), END
L8 Id (the short name of guarantees, assumptions and scenarios) = a word that is not reserved; it can contain - g-n1, f-1, g1a g- (ends with -)
L9 Decisione (the decision reference) = a word made of D- followed by digits only D-125 D125, operatore, D-12a
L10 Versione (version) = a dotted number without - 0.1, 1, 0.1.2 v1, -0.1
L11 Numero (number) = a dotted number with at most one dot, without - 180, 0.5 0.1.2, -3
L12 Numero con segno (signed number) = a dotted number with at most one dot, with or without - -20.0, 3, 0.5 -0.1.2
L13 Intero (integer) = a dotted number without dots and without - 1, 4 1.5, -1

Where the sign is needed the rule says so: only L12 admits it, in the limits of a range (G14), in values (G26) and in formulas (G59), where the minus in front of a value can also be written separated (- x). Versions, the times of steps (G21: @-1 is not a step), the limits of a multiplicity (G35) and of a repetition (G47) and resolutions (G52) remain unsigned.