{-# LANGUAGE DeriveDataTypeable #-} -- | Surface syntax of the language, obtained by running the BNFC-generated parser. -- This file is largely generated by bnfc; see the 'Preprocessor' module for -- what's used internally. module AbsLambdaMini where import Data.Data (Data) import Data.Typeable (Typeable) -- Haskell module generated by the BNF converter newtype FIdent = FIdent String deriving (Eq,Ord,Show) data Program = Prog [Func] deriving (Eq,Ord,Show) data Func = Func FIdent Exp deriving (Eq,Ord,Show) data Exp = EVar FIdent | EInt Integer | ETrue | EFalse | EApp Exp Exp | ENeg Exp | EMul Exp Exp | EDiv Exp Exp | EAdd Exp Exp | ESub Exp Exp | ELt Exp Exp | EGt Exp Exp | ELEq Exp Exp | EGEq Exp Exp | EEq Exp Exp | ENEq Exp Exp | EIf Exp Exp Exp | ELambda FIdent Type Exp deriving (Eq,Ord,Show) data Type = TBool | TInt | TFun Type Type deriving (Eq,Ord,Data,Typeable) instance Show Type where showsPrec _ TBool = showString "Bool" showsPrec _ TInt = showString "Int" showsPrec d (TFun t1 t2) = showsPrec 2 t1 . showString " -> " . showsPrec 1 t2