Describe situation of the evaluator code better.
Chris Pressey
13 days ago
4 | 4 | module Language.UampirNexol.Eval where |
5 | 5 | |
6 | 6 | -- |
7 | -- Evaluator for UampirNexol expressions. The evaluator is not meant to have | |
8 | -- value as something that is run, so much as something that describes | |
9 | -- meanings of (and can thus assign meanings to) UampirNexol expressions. | |
7 | -- Evaluator for UampirNexol expressions. | |
8 | -- | |
9 | -- The evaluator is not meant to have value as something that is executed, | |
10 | -- so much as something that describes meanings of (and can thus assign | |
11 | -- meanings to) UampirNexol expressions. | |
12 | -- | |
13 | -- The definition of the evaluator given here is also very poor. Better | |
14 | -- would be if the set of Values included functions. A typical UampirNexol | |
15 | -- program is a function taking states to states. Evaluating such an | |
16 | -- expression should result in a function value. But the way we have it | |
17 | -- here, necessarily we need to apply that function to a (state) value. | |
18 | -- We should change that. | |
10 | 19 | -- |
11 | 20 | |
12 | 21 | import qualified Data.Map as Map |
30 | 39 | let |
31 | 40 | i = case eval expr env v of |
32 | 41 | (Const (IntLit this)) -> this |
33 | other -> error $ "eek: " ++ (show other) | |
42 | other -> error $ "eek: " ++ (show other) | |
34 | 43 | i' = i `mod` 256 |
35 | 44 | z' = if i' == 0 then 1 else 0 |
36 | 45 | n' = if i' > 127 then 1 else 0 |