diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-08-12 22:53:06 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-08-12 22:53:06 +0100 |
commit | 279f04cb63e45ceb9a9df82540d5362565b8b37b (patch) | |
tree | bf71e8d7829e6ccf29320dacaf7c4742423683c5 /src/Ast.hs | |
download | micro-lang-hs-279f04cb63e45ceb9a9df82540d5362565b8b37b.tar.gz micro-lang-hs-279f04cb63e45ceb9a9df82540d5362565b8b37b.zip |
Initial import
Diffstat (limited to 'src/Ast.hs')
-rw-r--r-- | src/Ast.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/Ast.hs b/src/Ast.hs new file mode 100644 index 0000000..c43eed4 --- /dev/null +++ b/src/Ast.hs @@ -0,0 +1,27 @@ +module Ast where + +import Text.Parsec (SourcePos) + +type Ident = String + +data Type = Type String | FuncType [Type] (Maybe Type) deriving (Eq, Ord, Show) + +type FuncParam = (Ident, Type, SourcePos) + +data Expr + = Num Integer SourcePos + | BinOp Op Expr Expr + | Var Ident SourcePos + | -- fn [params] return body private pos + Func Ident [FuncParam] (Maybe Type) [Expr] Bool SourcePos + | Call Expr [Expr] SourcePos + | Return (Maybe Expr) SourcePos + | Module String SourcePos + deriving (Eq, Ord, Show) + +data Op + = Plus + | Minus + | Mul + | Div + deriving (Eq, Ord, Show) |