forked from andyarvanitis/idris-generic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AST.hs
65 lines (56 loc) · 1.72 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
module IRTS.Generic.AST where
import Data.Word
data ASTType = ASTIntTy
| ASTStringTy
| ASTIntegerTy
| ASTFloatTy
| ASTCharTy
| ASTPtrTy
| ASTForgotTy
deriving Eq
data ASTInteger = ASTBigInt Integer
| ASTBigIntExpr ASTNode
deriving Eq
data ASTNum = ASTInt Int
| ASTFloat Double
| ASTInteger ASTInteger
deriving Eq
data ASTWord = ASTWord8 Word8
| ASTWord16 Word16
| ASTWord32 Word32
| ASTWord64 Word64
deriving Eq
data ASTAnnotation = ASTConstructor deriving Eq
instance Show ASTAnnotation where
show ASTConstructor = "class"
data ASTNode = ASTRaw String
| ASTIdent String
| ASTFunction [String] ASTNode
| ASTType ASTType
| ASTSeq [ASTNode]
| ASTList [ASTNode]
| ASTReturn ASTNode
| ASTApp ASTNode [ASTNode]
| ASTError String
| ASTBinOp String ASTNode ASTNode
| ASTPreOp String ASTNode
| ASTPostOp String ASTNode
| ASTProj ASTNode String
| ASTPtrProj ASTNode String
| ASTArray [ASTNode]
| ASTString String
| ASTChar String
| ASTNum ASTNum
| ASTWord ASTWord
| ASTAssign ASTNode ASTNode
| ASTAlloc (Maybe String) String (Maybe ASTNode)
| ASTIndex ASTNode ASTNode
| ASTSwitch ASTNode [(ASTNode, ASTNode)] (Maybe ASTNode)
| ASTCond [(ASTNode, ASTNode)]
| ASTTernary ASTNode ASTNode ASTNode
| ASTParens ASTNode
| ASTWhile ASTNode ASTNode
| ASTFFI String [ASTNode]
| ASTAnnotation ASTAnnotation ASTNode
| ASTNoop
deriving Eq