lamb/AST.hs

45 lines
975 B
Haskell
Raw Permalink Normal View History

2013-10-21 00:48:02 +00:00
-- AST definition for the Lamb programming language
-- Copyright (c) 2013 darkf
-- Licensed under the terms of the zlib license, see LICENSE for details
module AST where
2014-11-02 08:14:23 +00:00
import qualified Data.Text as T
data AST = Add AST AST
2013-10-21 00:24:51 +00:00
| Sub AST AST
| Mul AST AST
2013-10-21 00:24:51 +00:00
| Div AST AST
| Equals AST AST
| NotEquals AST AST
| LessThan AST AST
| GreaterThan AST AST
2017-06-01 20:26:33 +00:00
| BitAnd AST AST
| BitOr AST AST
| BitNot AST
| BitShift AST AST Bool
| Block [AST]
2014-11-02 08:14:23 +00:00
| FunDef T.Text (Pattern, AST)
| Defun T.Text AST
| Def Pattern AST
2014-11-02 08:14:23 +00:00
| Var T.Text
| Lambda [(Pattern, AST)]
| Call AST AST
| Access AST AST
2013-10-21 05:27:27 +00:00
| Cons AST AST
2013-10-23 21:36:06 +00:00
| IfExpr AST AST AST
2013-10-22 22:10:34 +00:00
| TupleConst [AST]
| ListConst [AST]
2013-10-23 21:41:44 +00:00
| BoolConst Bool
2014-11-02 08:14:23 +00:00
| StrConst T.Text
| IntConst Integer
deriving (Show, Eq)
2014-11-02 08:14:23 +00:00
data Pattern = VarP T.Text
| IntP Integer
2014-11-02 08:14:23 +00:00
| StrP T.Text
2013-11-02 04:43:36 +00:00
| BoolP Bool
| ConsP Pattern Pattern
| TupleP [Pattern]
| ListP [Pattern]
2017-06-01 20:26:33 +00:00
deriving (Show, Eq)