summaryrefslogtreecommitdiff
path: root/DSL/Types.hs
diff options
context:
space:
mode:
authorMatthew Hall <hallmatthew314@gmail.com>2023-02-18 16:22:54 +1300
committerMatthew Hall <hallmatthew314@gmail.com>2023-02-18 16:22:54 +1300
commitf8a928d18371e0b67741f5d75b8154d1c105327b (patch)
tree78853084e99e2a0cc7fbc0112ef9c7010ec53e1e /DSL/Types.hs
parent69276220df02d2c226021d79ee4a4fd173ae85ee (diff)
Introduce procs
Diffstat (limited to 'DSL/Types.hs')
-rw-r--r--DSL/Types.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/DSL/Types.hs b/DSL/Types.hs
index bb1f862..0a4de3f 100644
--- a/DSL/Types.hs
+++ b/DSL/Types.hs
@@ -42,9 +42,12 @@ data Intrinsic
| I_GREATERTHAN
deriving (Show, Eq)
+type ProcName = String
+
data Operation
= OpPushData StackData
| OpIntrinsic Intrinsic
+ | OpCall ProcName
deriving (Show)
data StackModifier = StackModifier { smName :: String
@@ -59,14 +62,18 @@ data Block
| BWhile [Block] [Block]
deriving (Show)
+type ProcSpec = (ProcName, [Block])
+
type Program = [Block]
data Machine = Machine { ok :: Bool
, stack :: Stack
+ , pTable :: [(ProcName, [Block])]
}
data TokenTag
= T_WHITESPACE
+ | T_PROC
| T_IF
| T_ELSE
| T_WHILE
@@ -76,6 +83,7 @@ data TokenTag
| T_BOOL_LITERAL
| T_STRING_LITERAL
| T_INTRINSIC Intrinsic
+ | T_IDENTIFIER
deriving (Show, Eq)
data Token = Token { tStr :: String -- original text