@@ -32,8 +32,13 @@ langDef = Tok.LanguageDef
32
32
, Tok. identLetter = alphaNum <|> oneOf " _'"
33
33
, Tok. opStart = oneOf " :!#$%&*+./<=>?@\\ ^|-~;"
34
34
, Tok. opLetter = oneOf " :!#$%&*+./<=>?@\\ ^|-~;"
35
- , Tok. reservedNames = [" if" , " then" , " else" , " true" , " false" , " succ" ,
36
- " pred" , " iszero" , " unit" , " Bool" , " Nat" , " array" , " null" ]
35
+ , Tok. reservedNames = [" if" , " then" , " else" , " true" , " false" ,
36
+ " succ" , " pred" , " iszero" ,
37
+ " Bool" , " Nat" ,
38
+ " unit" , " Unit" ,
39
+ " ref" , " Ref" ,
40
+ " array" , " Array" ,
41
+ " null" , " NullType" ]
37
42
, Tok. reservedOpNames = []
38
43
, Tok. caseSensitive = True
39
44
}
@@ -101,7 +106,7 @@ pTerm = Ex.buildExpressionParser table factor
101
106
, Ex. Prefix (IsZero <$ reserved " iszero" )
102
107
, Ex. Prefix (Ref <$ reserved " ref" ) ]
103
108
, [ Ex. Infix (App <$ reservedOp " " ) Ex. AssocLeft ]
104
- , [ Ex. Infix (ArrayAccess <$ reservedOp " |" ) Ex. AssocLeft ]
109
+ , [ Ex. Infix (ArrayAccess <$ reservedOp " |" ) Ex. AssocLeft ]
105
110
, [ Ex. Infix (Assign <$ reservedOp " :=" ) Ex. AssocRight ]
106
111
, [ Ex. Infix (Seq <$ reservedOp " ;" ) Ex. AssocRight ] ]
107
112
@@ -111,13 +116,14 @@ pTypAtom :: Parser Type
111
116
pTypAtom = TyBool <$ reserved " Bool"
112
117
<|> TyNat <$ reserved " Nat"
113
118
<|> TyUnit <$ reserved " Unit"
119
+ <|> TyNull <$ reserved " NullType"
114
120
<|> TyTuple <$> braces (commaSep pTyp)
115
121
<|> parens pTyp
116
122
117
123
pTyp :: Parser Type
118
124
pTyp = Ex. buildExpressionParser table pTypAtom
119
- where table = [ [ Ex. Infix (TyFun <$ reservedOp " ->" ) Ex. AssocRight
120
- , Ex. Prefix (TyRef <$ reserved " Ref" )
125
+ where table = [ [ Ex. Infix (TyFun <$ reservedOp " ->" ) Ex. AssocRight
126
+ , Ex. Prefix (TyRef <$ reserved " Ref" )
121
127
, Ex. Prefix (TyArray <$ reserved " Array" ) ] ]
122
128
123
129
decToPeano :: Integer -> Term
0 commit comments