aboutsummaryrefslogtreecommitdiff
path: root/src/Syntax.hs
diff options
context:
space:
mode:
authorPaweł Dybiec <pawel.to.malpa@gmail.com>2020-01-20 03:08:05 +0100
committerPaweł Dybiec <pawel.to.malpa@gmail.com>2020-01-20 03:08:05 +0100
commit3810fcdcc4ad0d76193842271ce3392b3adba913 (patch)
tree3a8186f30536a7a4a95a509f71063a89f1f82e5d /src/Syntax.hs
parentFix variants typing, add wellformedness for commands (diff)
Add function calls in commands, and type annotations in expressions
Diffstat (limited to 'src/Syntax.hs')
-rw-r--r--src/Syntax.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Syntax.hs b/src/Syntax.hs
index f5d9c2d..18949d2 100644
--- a/src/Syntax.hs
+++ b/src/Syntax.hs
@@ -19,6 +19,7 @@ data Expr = Var Idnt
| Deref Expr
| Match Expr [(Idnt, Idnt, Expr)] -- Variant,Binder, Expression
| Proj Idnt Expr
+ | Annot Expr Typ
deriving(Eq,Show)
data Com = Skip
| Seq Com Com
@@ -29,10 +30,14 @@ data Com = Skip
| Alloc Idnt Expr Com
| Save Idnt Expr
| SMatch Expr [(Idnt, Idnt, Com)]
+ | FunctionCall Idnt Idnt [Expr] -- variable function_name parameters
deriving(Eq,Show)
-data FuncDecl = Func Idnt [Idnt] [(Idnt,Expr)] Com Expr
+data FuncDecl = Func Idnt [(Idnt, Typ)] [(Idnt,Expr)] Com Expr -- function_name [parameters] [local variables] body return_val
deriving(Eq,Show)
+data FuncSign = FuncSign [Typ] Typ
+ deriving(Eq,Show)
+type FuncEnv = [(Idnt,FuncSign)]
data Program = P [FuncDecl] [(Idnt, Int)] Com
deriving(Eq,Show)