add grammar
[minfp.git] / ast.dcl
1 definition module ast
2
3 from Data.Either import :: Either
4 from StdOverloaded import class toString
5
6 from int import :: Eval
7
8 :: Function = Function [Char] [[Char]] Expression
9 :: TypeDef = TypeDef [Char] [[Char]] [([Char], [Type])]
10
11 :: Expression
12 = Lit Value
13 | Var [Char]
14 | Tuple Expression Expression
15 | App Expression Expression
16 | Lambda [Char] Expression
17 | Let [([Char], Expression)] Expression
18
19 :: Value
20 = Int Int
21 | Bool Bool
22 | ** infix 9 Expression Expression
23 | Lambda` [Char] Expression
24 | Builtin (Expression -> Eval Expression)
25
26 :: Type
27 = TVar [Char]
28 | TTuple Type Type
29 | TInt
30 | TBool
31 | (-->) infixr 9 Type Type
32
33 instance toString Function, Expression, Value, Type, TypeDef