aboutsummaryrefslogtreecommitdiff
path: root/src/AST.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2024-02-25 21:01:13 +0100
committerTom Smeding <tom@tomsmeding.com>2024-02-25 21:01:13 +0100
commitf72bf16e2edc8d654e661cd59f820409219e5f27 (patch)
tree2986fcd5421c474f50b76214eccea93cb74850e0 /src/AST.hs
parentb0c81ee7def783037b514af9fdeab06f7e3bdb13 (diff)
Add HSVIS module prefix
Diffstat (limited to 'src/AST.hs')
-rw-r--r--src/AST.hs68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/AST.hs b/src/AST.hs
deleted file mode 100644
index 878c9fb..0000000
--- a/src/AST.hs
+++ /dev/null
@@ -1,68 +0,0 @@
-module AST where
-
-import Data.List.NonEmpty (NonEmpty)
-
-import Pretty
-
-
-newtype Name = Name String
- deriving (Show, Eq)
-
-data Program t = Program [DataDef] [FunDef t]
- deriving (Show)
-
-data DataDef = DataDef Name [Name] [(Name, [Type])]
- deriving (Show)
-
-data FunDef t = FunDef Name (Maybe Type) (NonEmpty (FunEq t))
- deriving (Show)
-
-data FunEq t = FunEq Name [Pattern t] (RHS t)
- deriving (Show)
-
-data Type
- = TApp Type [Type]
- | TTup [Type]
- | TList Type
- | TFun Type Type
- | TCon Name
- | TVar Name
- deriving (Show)
-
-data Pattern t
- = PWildcard t
- | PVar t Name
- | PAs t Name (Pattern t)
- | PCon t Name [Pattern t]
- | POp t (Pattern t) Operator (Pattern t)
- | PList t [Pattern t]
- | PTup t [Pattern t]
- deriving (Show)
-
-data RHS t
- = Guarded [(Expr t, Expr t)] -- currently not parsed
- | Plain (Expr t)
- deriving (Show)
-
-data Expr t
- = ELit t Literal
- | EVar t Name
- | ECon t Name
- | EList t [Expr t]
- | ETup t [Expr t]
- | EApp t (Expr t) [Expr t]
- | EOp t (Expr t) Operator (Expr t)
- | EIf t (Expr t) (Expr t) (Expr t)
- | ECase t (Expr t) [(Pattern t, RHS t)]
- | ELet t [FunDef t] (Expr t)
- deriving (Show)
-
-data Literal = LInt Integer | LFloat Rational | LChar Char | LString String
- deriving (Show)
-
-data Operator = OAdd | OSub | OMul | ODiv | OMod | OEqu | OPow
- | OCons
- deriving (Show)
-
-instance Pretty Name where
- prettysPrec _ (Name n) = showString ("\"" ++ n ++ "\"")