1 / 6

A Short Example

A Short Example. This example is from Chapter 11 of the text book It is a small example of specifying an “identifier” or “name” table with Z language The identifier table : Holds unique names of program variables, process names, or file names

enrico
Download Presentation

A Short Example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Short Example • This example is from Chapter 11 of the text book • It is a small example of specifying an “identifier” or “name” table with Z language • The identifier table : • Holds unique names of program variables, process names, or file names • Has an upper limit, max-id, in the total # of names. • Three operations against the identifier table is specified

  2. Example (cont.) • The set of identifiers or names is stated as follows: [ Identifiers ] • The schema for the table is : Sym_Table max-id : N table : F Identifiers # table =< max-id

  3. Example (cont.) • The schema representing the before and after states of the Sym_Table is as follows and note that • # table =<max-id and • # table’=<max-id Sym_Table Sym_Table Sym_Table’

  4. Example (cont.) • Specifying the “adding” of an identifier to the table Add_id id ? : Identifier Sym_Table id ? table table’ = table U { id? }

  5. Example (cont.) • Specifying the “removal” of an identifier fro the table Remove_id id ? : Identifier Sym_Table id ? table table’ = table \ { id? }

  6. Example (cont.) • Search for an id in the table. • This requires an additional definition by enumeration: Results ::= T I F Search_id id ? : Identifier Sym_Table found ! : Results id ? table -> found ! = T id? table -> found ! = F

More Related