$Id: WhileNDomains.lhs,v 1.2 1998/06/05 21:17:13 leavens Exp $

AUTHOR: Gary T. Leavens

Semantic Domains for the WhileN language of chapter 2 of
David A. Schmidt's "The Structure of Typed Programming Languages"
(MIT Press, 1994).

> module WhileNDomains (module WhileNDomains, module Domains,
>                       module Environments) where
> import Domains
> import Environments
> import WhileNParser (Identifier)
> import Numeric (showInt)

(Run-time) environments and denotable values.

> type DEnvironment = FiniteFun Identifier DenotableValue
> data DenotableValue =
>           DVInt DInt | DVBool DBool
>         | DVFun (DStore -> ExpressibleValue)
>         | DVProc (DStore -> DStore)
>         | DVLoc DLocation
>         | DVClass (DStore -> (DenotableValue, DStore))
>         | DVModule DEnvironment

And a Show instance for DenotableValue, so they can be debugged.

> instance Show DenotableValue where
>  showsPrec p (DVInt i) = showInt i
>  showsPrec p (DVBool True) = showString "true"
>  showsPrec p (DVBool False) = showString "false"
>  showsPrec p (DVFun _) = showString "<<function>>"
>  showsPrec p (DVProc _) = showString "<<procedure>>"
>  showsPrec p (DVLoc i) = showString "loc " . showInt i
>  showsPrec p (DVClass _) = showString "<<class>>"
>  showsPrec p (DVModule env) = showsPrec p env
