From 65c8beecb14f6d09c49504d74beedd58cc7ddd17 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Wed, 7 Sep 2022 16:26:50 +0100 Subject: Better project layout, removed warnings --- src/Ast.hs | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/Ast.hs (limited to 'src/Ast.hs') diff --git a/src/Ast.hs b/src/Ast.hs deleted file mode 100644 index 4f4a2f9..0000000 --- a/src/Ast.hs +++ /dev/null @@ -1,46 +0,0 @@ -module Ast where - -import Data.List (intercalate) -import Text.Parsec (SourcePos) - -type Ident = String - -data Type = Type String | FuncType [Type] (Maybe Type) deriving (Eq, Ord) - -instance Show Type where - show (Type t) = t - show (FuncType params rtyp) = - "(" ++ (intercalate ", " (fmap show params)) ++ ") -> " ++ case rtyp of - Just t -> show t - Nothing -> "()" - -showList :: [Type] -> String -showList xs = intercalate ", " $ fmap show xs - -type FuncParam = (Ident, Type, Bool, SourcePos) - -data Expr - = Num Integer SourcePos - | Bool' Bool SourcePos - | BinOp Op SourcePos Expr Expr - | Variable Ident SourcePos - | -- v type value private pos - Var Ident Type Expr Bool SourcePos - | -- fn [params] return body private anomyous pos - Func Ident [FuncParam] (Maybe Type) [Expr] Bool Bool SourcePos - | Call Expr [Expr] SourcePos - | Return (Maybe Expr) SourcePos - | Module String SourcePos - deriving (Eq, Ord, Show) - -data Op - = Assign - | Plus - | Minus - | Mul - | Div - deriving (Eq, Ord, Show) - -toFuncType :: [FuncParam] -> Maybe Type -> Type -toFuncType params rtyp = - FuncType (map (\(_, t, _, _) -> t) params) rtyp -- cgit v1.2.3