diff options
author | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2020-01-20 21:13:37 +0100 |
---|---|---|
committer | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2020-01-20 21:13:37 +0100 |
commit | e885cb8b286cccfb94cc5f81a3acd6f259ed6c28 (patch) | |
tree | b56c3415009730a6219b8636503e22beb8cc1c71 /src/Syntax.hs | |
parent | Evaluator (diff) |
Add evaluation of whole programs, typechecking functions and main main
Diffstat (limited to 'src/Syntax.hs')
-rw-r--r-- | src/Syntax.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Syntax.hs b/src/Syntax.hs index 18949d2..065f91d 100644 --- a/src/Syntax.hs +++ b/src/Syntax.hs @@ -6,7 +6,7 @@ data Typ = TInt | TRecord TypeDict | TVariant TypeDict | TPtr Typ - deriving(Eq,Show) + deriving(Eq,Show,Read) type TypeDict = [(Idnt,Typ)] data Expr = Var Idnt @@ -20,7 +20,7 @@ data Expr = Var Idnt | Match Expr [(Idnt, Idnt, Expr)] -- Variant,Binder, Expression | Proj Idnt Expr | Annot Expr Typ - deriving(Eq,Show) + deriving(Eq,Show,Read) data Com = Skip | Seq Com Com | If Expr Com Com @@ -31,13 +31,13 @@ data Com = Skip | Save Idnt Expr | SMatch Expr [(Idnt, Idnt, Com)] | FunctionCall Idnt Idnt [Expr] -- variable function_name parameters - deriving(Eq,Show) + deriving(Eq,Show,Read) data FuncDecl = Func Idnt [(Idnt, Typ)] [(Idnt,Expr)] Com Expr -- function_name [parameters] [local variables] body return_val - deriving(Eq,Show) + deriving(Eq,Show,Read) data FuncSign = FuncSign [Typ] Typ deriving(Eq,Show) type FuncEnv = [(Idnt,FuncSign)] -data Program = P [FuncDecl] [(Idnt, Int)] Com - deriving(Eq,Show) +data Program = Program [FuncDecl] [(Idnt, Expr)] Com + deriving(Eq,Show,Read) |