-
Notifications
You must be signed in to change notification settings - Fork 0
/
AST.hs
44 lines (35 loc) · 1.01 KB
/
AST.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
https://powcoder.com
代写代考加微信 powcoder
Assignment Project Exam Help
Add WeChat powcoder
https://powcoder.com
代写代考加微信 powcoder
Assignment Project Exam Help
Add WeChat powcoder
module AST where
type ErrMsg = String -- human-readable error messages
type VName = String -- variable names
type FName = String -- function (including operator) names
type PName = String -- predicate names
data Term =
TVar VName
| TNum Integer
| TFun FName [Term]
deriving (Eq, Ord, Show, Read)
data Cond = Cond PName [Term] [Term]
deriving (Eq, Show, Read)
data Rule = Rule Term Term [Cond]
deriving (Eq, Show, Read)
data Cmd =
CRule Rule
| CQuery Term Bool{-verbosity flag-}
deriving (Eq, Show, Read)
data Fixity = FLeft | FRight | FNone
deriving (Eq, Show, Read)
data OpTable = OpTable [(Fixity, [FName])]
deriving (Eq, Show, Read)
-- the remaing definitions only relate to the Semantics part
data Rsp = Rsp [Term] (Maybe ErrMsg)
deriving (Eq, Show)
maxSteps :: Int
maxSteps = 1000