Slide 7.3: The semantic domains of the calculator language
Slide 7.5: The semantic functions of the calculator language
Home

The Semantic Domains of the Calculator (Cont.)


Calculator arithmetic will be modeled by several auxiliary functions that carry out the three basic binary operations and an “identity” operation for the case when no operator is pending. Although the meaning of a calculator program will be the final integer value shown on the display, the behavior of the calculator in response to individual keystrokes and partial results will be studied too. This meaning depends on the following semantic domains:

    Domains
        v: Integer = { ..., -2, -1, 0, 1, 2, ...}
        s: State = Integer × Operation × Integer × Integer

    Operations
        +: Integer × Integer Integer
        –: Integer × Integer Integer
        *: Integer × Integer Integer
        nop: Integer × Integer Integer     where nop( a, d ) = d
State Tuple Value Tokens that May Alter the Value
Accumulator Clear, +, , and ×
Operator Flag Clear, +, , ×, =, and M+
Display Clear, numeral, =, M+, MR, and +/-
Memory Clear and M+

To Divide use / Symbol