blob: 0aaf16dbf4f58575d7c45ca2ff977c55e66e8730 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
module Language.SimpleShell.AST.Expr
( Expr(..)
, TypedExpr
, VarName
, FunName
)
where
import Language.SimpleShell.AST.SimpleType (SimpleType)
import Data.Text (Text)
type VarName = Text
type FunName = Text
-- | Pure expression (no side effects).
data Expr
= IntLiteral Integer
| StrLiteral String
| BoolLiteral Bool
| Var VarName
| FunCall FunName [Expr]
| And Expr Expr
| Or Expr Expr
| Not Expr
| Eq Expr Expr
| Neq Expr Expr
| Gt Expr Expr
| Ge Expr Expr
| Lt Expr Expr
| Le Expr Expr
| Add Expr Expr
| Sub Expr Expr
| Mul Expr Expr
| Div Expr Expr
| UMinus Expr
| Concat Expr Expr
| Ternary Expr Expr Expr
| Length Expr
| IntCast Expr
| StrCast Expr
deriving (Show)
type TypedExpr = (SimpleType, Expr)
|