diff options
author | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2020-01-19 22:59:54 +0100 |
---|---|---|
committer | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2020-01-19 22:59:54 +0100 |
commit | 0c815fa3eb480ae5e05370699cead004d81cf65c (patch) | |
tree | 93d52978256d18d5ab47f1e247fc31539166f3e4 /src/Syntax.hs | |
parent | More tests (diff) |
Add Except monad, and destructors for records and variants
Diffstat (limited to 'src/Syntax.hs')
-rw-r--r-- | src/Syntax.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Syntax.hs b/src/Syntax.hs index c33f7b3..bbd8cbe 100644 --- a/src/Syntax.hs +++ b/src/Syntax.hs @@ -3,10 +3,11 @@ module Syntax type Idnt = String data Typ = TInt - | TRecord [(Idnt, Typ)] - | TVariant [(Idnt, Typ)] + | TRecord TypeDict + | TVariant TypeDict | TPtr Typ deriving(Eq,Show) +type TypeDict = [(Idnt,Typ)] data Expr = Var Idnt | IntLit Int @@ -16,6 +17,8 @@ data Expr = Var Idnt | Mult Expr Expr | Neg Expr | Deref Expr + | Match Expr [(Idnt, Expr)] + | Proj Idnt Expr deriving(Eq,Show) data Com = Skip | Seq Com Com @@ -25,6 +28,7 @@ data Com = Skip | Decl Idnt Expr Com | Alloc Idnt Expr | Save Idnt Expr + | SMatch Expr [(Idnt, Expr)] deriving(Eq,Show) data FuncDecl = Func Idnt [Idnt] [(Idnt,Expr)] Com Expr |