-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVar.hs
More file actions
44 lines (33 loc) · 807 Bytes
/
Var.hs
File metadata and controls
44 lines (33 loc) · 807 Bytes
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
{-# LANGUAGE TemplateHaskell, GeneralizedNewtypeDeriving #-}
module Var
( VarID(..)
, FunID(..)
, Var(..)
, Fun(..)
, NativeFunction(..)
) where
import Data.Binary
import DeriveBinary
import Types
newtype VarID = VarID Int
deriving (Eq, Ord, Show, Binary)
newtype FunID = FunID Int
deriving (Eq, Ord, Show, Binary)
data Var
= LocalVar Int
| ArgVar Int
| RefArgVar Int
| StackVar Int
| ImportedVar LVarName
| ResolvedVar VarID
deriving Show
deriveBinary ''Var
data NativeFunction = NativeFunction FunName Name Arity
deriving (Show, Eq, Ord)
deriveBinary ''NativeFunction
data Fun
= ImportedFun LFunName Arity
| ResolvedNativeFun NativeFunction
| ResolvedFun FunID
deriving Show
deriveBinary ''Fun