25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>VDM</strong>-<strong>10</strong> <strong>Language</strong> <strong>Manual</strong><br />

Examples: The example below, taken from [Fitzgerald&98] assigns token values to identifiers p1<br />

and eid2, an Expert record value to e3 and an Alarm record value to a1.<br />

✞<br />

types<br />

Period = token;<br />

ExpertId = token;<br />

Expert :: expertid : ExpertId<br />

quali : set of Qualification<br />

inv ex == ex.quali {};<br />

Qualification = | | | ;<br />

Alarm :: alarmtext : seq of char<br />

quali : Qualification<br />

values<br />

public p1: Period = mk_token("Monday day");<br />

private eid2 : ExpertId = mk_token(145);<br />

protected e3 : Expert = mk_Expert(eid2, { , });<br />

a1 : Alarm = mk_Alarm("CO2 detected", )<br />

✡✝<br />

✆<br />

As this example shows, a value can depend on other values which are defined previous<br />

to itself. The access modifiers private, protected and public can only be used in<br />

<strong>VDM</strong>++ and <strong>VDM</strong>-RT. A top-level <strong>VDM</strong>-SL specification can consist of specifications from<br />

a number of files or modules (see section 17). It is good practice not to let a value depend on<br />

values defined in other modules as the ordering is important.<br />

82

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!