{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
module BNFC_Gen.AbsABS where

-- Haskell module generated by the BNF converter


import Data.Data (Data,Typeable)
import GHC.Generics (Generic)
newtype U = U ((Int,Int),String)
  deriving (Show, Read, Data, Typeable, Generic)
newtype L = L ((Int,Int),String)
  deriving (Show, Read, Data, Typeable, Generic)
data Literal
    = LNull | LThis | LStr String | LInt Integer | LFloat Double
  deriving (Show, Read, Data, Typeable, Generic)

data QU = U_ U | QU U QU
  deriving (Show, Read, Data, Typeable, Generic)

data QL = L_ L | QL U QL
  deriving (Show, Read, Data, Typeable, Generic)

data QA = LA L | UA U | QA U QA
  deriving (Show, Read, Data, Typeable, Generic)

data T = TSimple QU | TPoly QU [T] | TInfer
  deriving (Show, Read, Data, Typeable, Generic)

data FormalPar = FormalPar T L
  deriving (Show, Read, Data, Typeable, Generic)

data Program = Program [Module]
  deriving (Show, Read, Data, Typeable, Generic)

data Module = Module QU [Export] [Import] [AnnDecl] MaybeBlock
  deriving (Show, Read, Data, Typeable, Generic)

data Export
    = StarExport
    | StarFromExport QU
    | AnyExport [QA]
    | AnyFromExport [QA] QU
  deriving (Show, Read, Data, Typeable, Generic)

data Import
    = StarFromImport IsForeign QU
    | AnyImport IsForeign [QA]
    | AnyFromImport IsForeign [QA] QU
  deriving (Show, Read, Data, Typeable, Generic)

data IsForeign = NoForeign | YesForeign
  deriving (Show, Read, Data, Typeable, Generic)

data Decl
    = DType U T
    | DTypePoly U [U] T
    | DData U [ConstrIdent]
    | DDataPoly U [U] [ConstrIdent]
    | DFun T L [FormalPar] FunBody
    | DFunPoly T L [U] [FormalPar] FunBody
    | DInterf U [MethSig]
    | DExtends U [QU] [MethSig]
    | DClass U [ClassBody] MaybeBlock [ClassBody]
    | DClassPar U [FormalPar] [ClassBody] MaybeBlock [ClassBody]
    | DClassImplements U [QU] [ClassBody] MaybeBlock [ClassBody]
    | DClassParImplements U [FormalPar] [QU] [ClassBody] MaybeBlock [ClassBody]
    | DException ConstrIdent
  deriving (Show, Read, Data, Typeable, Generic)

data ConstrIdent
    = SinglConstrIdent U | ParamConstrIdent U [ConstrType]
  deriving (Show, Read, Data, Typeable, Generic)

data ConstrType = EmptyConstrType T | RecordConstrType T L
  deriving (Show, Read, Data, Typeable, Generic)

data FunBody = BuiltinFunBody | NormalFunBody PureExp
  deriving (Show, Read, Data, Typeable, Generic)

data MethSig = MethSig [Ann] T L [FormalPar]
  deriving (Show, Read, Data, Typeable, Generic)

data ClassBody
    = FieldClassBody T L
    | FieldAssignClassBody T L PureExp
    | MethClassBody T L [FormalPar] [AnnStm]
  deriving (Show, Read, Data, Typeable, Generic)

data Stm
    = SSkip
    | SSuspend
    | SReturn Exp
    | SAssert PureExp
    | SAwait AwaitGuard
    | SAss L Exp
    | SFieldAss L Exp
    | SDec T L
    | SDecAss T L Exp
    | SWhile PureExp AnnStm
    | SIf PureExp Stm
    | SIfElse PureExp Stm Stm
    | SCase PureExp [SCaseBranch]
    | SBlock [AnnStm]
    | SExp Exp
    | SPrint PureExp
    | SPrintln PureExp
    | SThrow PureExp
    | STryCatchFinally AnnStm [SCaseBranch] MaybeFinally
    | SGive PureExp PureExp
    | SDuration PureExp PureExp
  deriving (Show, Read, Data, Typeable, Generic)

data SCaseBranch = SCaseBranch Pattern AnnStm
  deriving (Show, Read, Data, Typeable, Generic)

data AwaitGuard
    = GFut L
    | GFutField L
    | GExp PureExp
    | GAnd AwaitGuard AwaitGuard
    | GDuration PureExp PureExp
  deriving (Show, Read, Data, Typeable, Generic)

data Exp = ExpP PureExp | ExpE EffExp
  deriving (Show, Read, Data, Typeable, Generic)

data PureExp
    = EOr PureExp PureExp
    | EAnd PureExp PureExp
    | EEq PureExp PureExp
    | ENeq PureExp PureExp
    | ELt PureExp PureExp
    | ELe PureExp PureExp
    | EGt PureExp PureExp
    | EGe PureExp PureExp
    | EAdd PureExp PureExp
    | ESub PureExp PureExp
    | EMul PureExp PureExp
    | EDiv PureExp PureExp
    | EMod PureExp PureExp
    | ELogNeg PureExp
    | EIntNeg PureExp
    | EFunCall QL [PureExp]
    | ENaryFunCall QL [PureExp]
    | EVar L
    | EField L
    | ESinglConstr QU
    | EParamConstr QU [PureExp]
    | ELit Literal
    | ELet FormalPar PureExp PureExp
    | EIf PureExp PureExp PureExp
    | ECase PureExp [ECaseBranch]
  deriving (Show, Read, Data, Typeable, Generic)

data ECaseBranch = ECaseBranch Pattern PureExp
  deriving (Show, Read, Data, Typeable, Generic)

data Pattern
    = PLit Literal
    | PVar L
    | PSinglConstr QU
    | PParamConstr QU [Pattern]
    | PWildCard
  deriving (Show, Read, Data, Typeable, Generic)

data EffExp
    = New QU [PureExp]
    | NewLocal QU [PureExp]
    | SyncMethCall PureExp L [PureExp]
    | ThisSyncMethCall L [PureExp]
    | AsyncMethCall PureExp L [PureExp]
    | AwaitMethCall PureExp L [PureExp]
    | Get PureExp
    | Readln
    | ProNew
    | ProTry PureExp
    | ThisDC
    | Now
    | Currentms
    | Random PureExp
  deriving (Show, Read, Data, Typeable, Generic)

data Ann = Ann Ann_
  deriving (Show, Read, Data, Typeable, Generic)

data Ann_ = AnnNoType PureExp | AnnWithType T PureExp
  deriving (Show, Read, Data, Typeable, Generic)

data AnnStm = AnnStm [Ann] Stm
  deriving (Show, Read, Data, Typeable, Generic)

data AnnDecl = AnnDecl [Ann] Decl
  deriving (Show, Read, Data, Typeable, Generic)

data MaybeFinally = JustFinally AnnStm | NoFinally
  deriving (Show, Read, Data, Typeable, Generic)

data MaybeBlock = JustBlock [AnnStm] | NoBlock
  deriving (Show, Read, Data, Typeable, Generic)

