-- vim: et ts=2 sw=2 ai: module SPL.Syntax where type Name = String data Program = Program { funs :: [Function] , vars :: [Variable] } data Function = Function { fname :: Name , ftype :: Type , fcode :: Statement } data Variable = Variable { vname :: Name , vtype :: Type } data Type = Type -- TODO data Statement = If Expression Statement (Maybe Statement) | While Expression Statement | Assign Name Expression | Eval Expression | Return (Maybe Expression) | Seq Statement Statement data Expression = Field Name Field | Op2 Expression Op2 Expression | Op1 Op1 Expression | Literal Literal | FunCall Name [Expression] | Tuple Expression Expression data Field = Hd | Tl | Fst | Snd data Op2 = Add | Sub | Mul | Div | Mod | Eq | Lt | Gt | Le | Ge | Ne | And | Or | Cons data Op1 = Not | Neg data Literal = LInt Int | LChar Char | LBool Bool | LNil