Link Search Menu Expand Document

Unstable-Languages-beta : IMPPP-3.cbs | PRETTY | PDF


Language "IMPPP"

3 Boolean expressions

Syntax
  BExp : bexp ::= 'false'
               |  'true'
               |  aexp '<=' aexp
               |  '!' bexp
               |  bexp '&&' bexp
               |  '(' bexp ')'
Semantics
  eval-bool[[ _:bexp ]] : =>booleans
Rule
  eval-bool[[ 'false' ]] = false 
Rule
  eval-bool[[ 'true' ]] = true 
Rule
  eval-bool[[ AExp1 '<=' AExp2 ]] = 
    is-less-or-equal left-to-right(eval-arith[[ AExp1 ]], eval-arith[[ AExp2 ]])
Rule
  eval-bool[[ '!' BExp ]] = not(eval-bool[[ BExp ]])
Rule
  eval-bool[[ BExp1 '&&' BExp2 ]] = 
    if-true-else(eval-bool[[ BExp1 ]], eval-bool[[ BExp2 ]], false)
Rule
  eval-bool[[ '(' BExp ')' ]] = eval-bool[[ BExp ]]