module Mathista.AST where
type Id = String

type Var = (Id, Maybe [(Expr, Maybe Expr)])

data Stmt
    = If [(Expr, [Stmt])] (Maybe [Stmt])
    | While Expr [Stmt]
    | For Id Integer Integer [Stmt]
    | Assign [Var] Expr
    | Return [Expr]
    | Break
    | Continue
    | FuncDecl Id [(Id, Id)] [Id] [Stmt]
    | ExprStmt Expr
    | DoNothing
    deriving (Show, Eq)

data Expr
    = VarRef Var
    | Add   Expr Expr
    | Sub   Expr Expr
    | Mul   Expr Expr
    | Div   Expr Expr
    | Eq    Expr Expr
    | Neq   Expr Expr
    | Gt    Expr Expr
    | Gte   Expr Expr
    | Lt    Expr Expr
    | Lte   Expr Expr
    | And   Expr Expr
    | Or    Expr Expr
    | Not   Expr
    | Plus  Expr
    | Minus Expr
    | FuncCall Id [Expr]
    | Number Double
    | Matrix [Expr]
    deriving (Show, Eq)