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

5. Where each declaration holds

A declaration written correctly but in the wrong place is not recognised.

Where What is recognised there Notes
Outside a block G1, G31, G40, G48, G49 END here is error E08; a declaration that begins with REFINEMENT is error E15 and opens a withdrawn block (section 4.8); one that begins with EXTENSION is error E32 (section 4.11); everything else is unrecognised
Inside CSC … END G3, G4, G6, G7, G8, G11, G12, G16, G19, G21, G30, G37, G39, G41, G47, uses of extensions of KIND DECLARATION and LEVEL CSC see the three following rows; a declaration that begins with CSC, ENTITY, REFINEMENT, BINDING, VERIFICATION or PROFILE closes the CSC with E07; one that begins with EXTENSION is E32; G32, G33 and G34 are unrecognised there. A qualified name in a scenario is E20 (section 4.6)
— STATUS, IMPORT PROFILE at any point of the header zone, in any order with PURPOSE (section 4.2); STATUS at most once a second STATUS in the zone is E10; after the zone they are not recognised
— PURPOSE exactly one per CSC if it is missing or repeated: E10
— @ steps and REPEAT only after a line that begins with SCENARIO (even if that line is not recognised), with only steps, REPEAT lines (G47), comments and blank lines between the two every other declaration closes the scenario; a REPEAT line outside a scenario is not recognised
Inside BINDING … END G3, G4, G39 in the header zone, G51, uses of extensions of KIND DECLARATION and LEVEL BINDING section 4.11; CSC, ENTITY, REFINEMENT, BINDING, VERIFICATION and PROFILE close the block with E07; EXTENSION is E32
Inside VERIFICATION … END G3, G39 in the header zone, G52, G53 with its steps G21 and the lines G47, uses of extensions of KIND DECLARATION and LEVEL VERIFICATION STATUS is E39 at any point; for the rest as in a BINDING
Inside PROFILE … END G3, G4 and G6 in the header zone, G50 which opens an extension every other declaration is unrecognised; CSC, ENTITY, REFINEMENT, BINDING, VERIFICATION and PROFILE close the profile with E07
Inside EXTENSION … END (in a profile) G3, G43, G44, G45, G46, G54 every other declaration is unrecognised; CSC, ENTITY, REFINEMENT, BINDING, VERIFICATION and PROFILE close the extension and the profile, with one E07 on the profile
Inside a withdrawn block (REFINEMENT … up to END) only G3 every other declaration is unrecognised and registers no names; CSC, ENTITY and REFINEMENT close the block with E07 (section 4.8)
Inside ENTITY … END G3, G4 only with STATUS HYPOTHESIS, G39 in the header zone, G6, G32, G33, a single G28, G34, G16 with GUARANTEE (with every STATUS, as in the CSC, and with the formulas of section 4.9), G19, G21 and G47 with the qualified names (section 4.6), G38 (section 4.10), uses of extensions of KIND RELATION and LEVEL ENTITY see the six following rows. OFFERS and USES at any point. The words that open a block close the entity there with E07, as in the CSC; EXTENSION is E32
— VARIANT segments from a G38 line to the next one or to END: G32, G33, one G28 per segment, G34, G16 with GUARANTEE, G19 and G21 PURPOSE is E21; the other cases are in section 4.10. In a CSC block a declaration that begins with VARIANT is E21
— STATUS only STATUS HYPOTHESIS, at any point of the header zone (section 4.9); a second STATUS HYPOTHESIS in the zone is E10 every other STATUS, including a valid STATUS RATIFIED BY D-n and STATUS RATIFIED without a decision, is not recognised, without E04; the status of the block remains without STATUS: the header of an entity is never approved. Inside a GUARANTEE the STATUSes of the CSC hold: STATUS HYPOTHESIS, STATUS RATIFIED BY D-n, and STATUS RATIFIED without a decision with E04 (the guarantee remains recognised and pending approval)
— PURPOSE exactly one per entity if it is missing or repeated: E10
— G34 parts at any point of the entity, also without COMPOSED OF every declaration that respects G34 is a part; COMPOSED OF is written only once, wherever one wishes, and a second one is not recognised, without effect. The rules, the reasons and the edge cases are immediately below the table
— SCENARIO, @ steps recognised with G19, G21 and the variants G20e, G23e, G24e (section 4.6) as in the CSC: the steps only after a line that begins with SCENARIO, with only steps, comments and blank lines between the two
— ASSUME, CAPABILITY, EVENT, STATE, DEFINE, TYPE not recognised, and error E18 on the keyword, whatever follows it an entity has no elements of its own. They register no name, not even ASSUME with a valid line header nor DEFINE Nome :=, and they do not appear in section 2. The VERIFY and VERBAL lines that continue an ASSUME (U4) remain unrecognised with it, without another E18. Cases below the table

Error E18. An entity has no CAPABILITY, EVENT, STATE, DEFINE, TYPE or ASSUME of its own: bcdd reads the keyword and knows that it is out of place, so it is an error, like E15. Edge cases:

What a guarantee of the entity takes for granted about the other side of a boundary is written as an assumption (ASSUME) in the CSC of that boundary. A guarantee of the entity is written as a GUARANTEE of the entity or in the CSC that the entity provides.

The parts of an entity. In an entity every declaration that respects G34 is a part, wherever it stands: before or after COMPOSED OF, among the guarantees, after OFFERS and USES, after unrecognised lines, after a second COMPOSED OF, and also in an entity that has no COMPOSED OF. There is no list that opens and closes: the parts stand wherever one wishes, like OFFERS and USES.

Why no case remains in which a G34 declaration inside an entity does not become a checked part, or an unrecognised line removes the check from a part. A declaration is a part if and only if (1) it is a declaration (section 3), (2) it stands in an ENTITY block (section 5), (3) it respects G34 and (4) its name does not have E01. None of these four conditions depends on whether another declaration is recognised or not, except in the cases below, each with a signal outside section 5 or excluded from entities by construction:

Case What happens Signal
the text p : X stands inside a string that breaks across lines it is not a declaration (L2, U3): it is text none, as a matter of principle: a string can contain any text. With a single quotation mark too many or too few in the file, the quotation marks outside comments are odd in number and bcdd signals E06. A stretch of lines becomes a string without errors only with two wrong quotation marks. Known limitation
the name of the part is repeated, or is the short name of a guarantee (also of an unrecognised guarantee with a valid G16 line header, section 4.5) the part is not looked for E01, code 1
an END on its own before the part the entity has ended: the line is outside a block if the END of the entity comes afterwards, E08
a CSC, a REFINEMENT or an ENTITY before the part it closes the entity and opens another block E07 (and E09 if the header is badly written; with REFINEMENT, E15)
a part not found it suspends E14 for its entity it is in section 7, with the reason if there is one
p : X in a CSC or in a withdrawn block it is not an entity: it is not recognised (a CSC has no parts; a withdrawn block has no parts, section 4.8) outside entities, by construction

The case that remains: an entity in which no line is a part has no entries in section 8 and no E14, and without --strict an unrecognised line does not change the code.

Other rules on blocks: