1
0
This repository has been archived on 2025-03-31. You can view files and clone it, but cannot push or open issues or pull requests.
opal-examples/Blatt07/Environment.sign
2013-10-19 01:17:37 +02:00

24 lines
631 B
Plaintext

SIGNATURE Environment
IMPORT Denotation COMPLETELY
IMPORT SafeNat COMPLETELY
TYPE binding == binding(key: denotation, value: safeNat)
TYPE environment == environment(bindings: seq[binding])
FUN emptyenv : environment
FUN lookup : environment ** denotation -> safeNat
FUN bind : environment ** denotation ** safeNat -> environment
FUN testenv : environment
DEF testenv == bind(bind(emptyenv,"test",ok(5)),"test2",ok(2))
FUN test1 : safeNat
DEF test1 == lookup(testenv,"test")
FUN test2 : safeNat
DEF test2 == lookup(testenv,"test2")
FUN testfail : safeNat
DEF testfail == lookup(testenv, "isnichdrin")