uuagc-0.9.27: src-derived/GenerateCode.hs
-- UUAGC 0.9.26 (GenerateCode.ag)
module GenerateCode where
{-# LINE 9 "GenerateCode.ag" #-}
import CommonTypes
import SequentialTypes
import Code hiding (Type)
import qualified Code
import Options
import CodeSyntax
import ErrorMessages
import GrammarInfo
import DeclBlocks
import qualified Data.Map as Map
import Data.Map(Map)
import qualified Data.Set as Set
import Data.Set(Set)
import qualified Data.Sequence as Seq
import Data.Sequence(Seq)
import UU.Scanner.Position
import TokenDef
import HsToken
import HsTokenScanner
import Data.List(partition,intersperse,intersect,(\\))
import Maybe(fromJust,isJust)
{-# LINE 31 "../src-derived/GenerateCode.hs" #-}
{-# LINE 2 "./CodeSyntax.ag" #-}
import Patterns
import CommonTypes
import Data.Map(Map)
import Data.Set(Set)
{-# LINE 39 "../src-derived/GenerateCode.hs" #-}
{-# LINE 2 "./Patterns.ag" #-}
-- Patterns.ag imports
import UU.Scanner.Position(Pos)
import CommonTypes (ConstructorIdent,Identifier)
{-# LINE 46 "../src-derived/GenerateCode.hs" #-}
{-# LINE 2 "./DeclBlocks.ag" #-}
import Code (Decl,Expr)
{-# LINE 51 "../src-derived/GenerateCode.hs" #-}
{-# LINE 101 "GenerateCode.ag" #-}
-- remove possible @v references in the types of a data type.
cleanupArg :: String -> String
cleanupArg s
= case idEvalType (SimpleType s) of
SimpleType s' -> s'
{-# LINE 59 "../src-derived/GenerateCode.hs" #-}
{-# LINE 115 "GenerateCode.ag" #-}
appContext :: ContextMap -> NontermIdent -> Code.Type -> Code.Type
appContext mp nt tp
= maybe tp (\ctx -> CtxApp (map (\(n,ns) -> (getName n, ns)) ctx) tp) $ Map.lookup nt mp
{-# LINE 66 "../src-derived/GenerateCode.hs" #-}
{-# LINE 209 "GenerateCode.ag" #-}
mkDecl True lhs rhs _ _ = Bind lhs rhs
mkDecl False lhs rhs s1 s2 = Decl lhs rhs s1 s2
unwrapSem :: Bool -> NontermIdent -> Expr -> Expr
unwrapSem False _ e = e
unwrapSem True nm e = Case e alts
where alts = [CaseAlt left right]
left = Fun (typeName nm 0) [SimpleExpr "x"]
right = SimpleExpr "x"
{-# LINE 79 "../src-derived/GenerateCode.hs" #-}
{-# LINE 375 "GenerateCode.ag" #-}
substSelf nt tp = case tp of
NT t tps | t == _SELF -> Haskell (getName nt ++ " " ++ unwords tps)
_ -> tp
{-# LINE 86 "../src-derived/GenerateCode.hs" #-}
{-# LINE 497 "GenerateCode.ag" #-}
mkLambdaArg :: String -> Maybe Code.Type -> Expr
mkLambdaArg nm Nothing = SimpleExpr nm
mkLambdaArg nm (Just tp) = TypedExpr (SimpleExpr nm) tp
mkLambda :: Exprs -> Expr -> Expr
mkLambda [] e = e
mkLambda xs e = Lambda xs e
typeAppStrs nm params = TypeApp (SimpleType nm) (map SimpleType params)
isHigherOrder :: Maybe (Maybe Type) -> Bool
isHigherOrder (Just Nothing) = True
isHigherOrder _ = False
pickOrigType :: (Identifier, Type, Maybe (Maybe Type)) -> (Identifier, Type, Maybe (Maybe Type))
pickOrigType (nm, tp, virt@(Just (Just x))) = (nm, x, virt)
pickOrigType x = x
{-# LINE 107 "../src-derived/GenerateCode.hs" #-}
{-# LINE 574 "GenerateCode.ag" #-}
mkPartitionedFunction :: String -> Bool -> [Decl] -> [String] -> DeclBlocks -> ([Decl], Expr)
mkPartitionedFunction prefix optCase nextVisitDecls lastExprVars cpsTree
= let inh = Inh_DeclBlocksRoot { prefix_Inh_DeclBlocksRoot = prefix
, optCase_Inh_DeclBlocksRoot = optCase
, nextVisitDecls_Inh_DeclBlocksRoot = nextVisitDecls
, lastExprVars_Inh_DeclBlocksRoot = lastExprVars
}
sem = sem_DeclBlocksRoot (DeclBlocksRoot cpsTree)
syn = wrap_DeclBlocksRoot sem inh
in (lambdas_Syn_DeclBlocksRoot syn, firstCall_Syn_DeclBlocksRoot syn)
{-# LINE 121 "../src-derived/GenerateCode.hs" #-}
{-# LINE 624 "GenerateCode.ag" #-}
freevars :: [String] -> [Decl] -> [String]
freevars additional decls
= Set.toList (allused `Set.difference` alldefined)
where
allused = Set.unions (Set.fromList additional : map usedvars decls)
alldefined = Set.unions (map definedvars decls)
usedvars (Decl _ _ _ uses) = uses
usedvars _ = Set.empty
definedvars (Decl _ _ defs _) = defs
definedvars _ = Set.empty
mkBlockLambda :: Bool -> String -> [String] -> [Decl] -> Expr -> Decl
mkBlockLambda optCase name args decls expr
= Decl lhs rhs Set.empty Set.empty
where
lhs = Fun name (map SimpleExpr args)
rhs = mkLet optCase decls expr
{-# LINE 144 "../src-derived/GenerateCode.hs" #-}
{-# LINE 687 "GenerateCode.ag" #-}
typeToCodeType :: Maybe NontermIdent -> [String] -> Type -> Code.Type
typeToCodeType mbNt params tp
= case tp of
NT nt tps | nt == _SELF -> NontermType (maybe "Unknown" getName mbNt) params
| otherwise -> NontermType (getName nt) tps
Haskell t -> SimpleType t
evalType :: (String -> String) -> Code.Type -> Code.Type
evalType replf t
= chase t
where
chase t
= case t of
Arr l r -> Arr (chase l) (chase r)
TypeApp f as -> TypeApp (chase f) (map chase as)
TupleType tps -> TupleType (map chase tps)
UnboxedTupleType tps -> UnboxedTupleType (map chase tps)
Code.List tp -> Code.List (chase tp)
SimpleType txt -> let tks = lexTokens (initPos txt) txt
tks' = map replaceTok tks
txt' = unlines . showTokens . tokensToStrings $ tks'
in SimpleType txt'
TMaybe m -> TMaybe (chase m)
TEither l r -> TEither (chase l) (chase r)
TMap k v -> TMap (chase k) (chase v)
TIntMap v -> TIntMap (chase v)
_ -> t
replaceTok t
= case t of
AGLocal v p _ -> HsToken (replf $ getName v) p
_ -> t
idEvalType :: Code.Type -> Code.Type
idEvalType = evalType id
{-# LINE 183 "../src-derived/GenerateCode.hs" #-}
{-# LINE 810 "GenerateCode.ag" #-}
-- for a virtual child that already existed as a child, returns
isFirstOrder :: Maybe (Maybe Type) -> Type -> Maybe Type
isFirstOrder Nothing tp = Just tp
isFirstOrder (Just x) _ = x
{-# LINE 191 "../src-derived/GenerateCode.hs" #-}
{-# LINE 830 "GenerateCode.ag" #-}
makeLocalComment :: Int -> String -> Identifier -> Maybe Type -> String
makeLocalComment width what name tp = let x = getName name
y = maybe "_" (\t -> case t of (NT nt tps) -> getName nt ++ " " ++ unwords tps; Haskell t -> '{':t++"}") tp
in ( what ++ " " ++ x ++ replicate ((width - length x) `max` 0) ' ' ++ " : " ++ y )
{-# LINE 200 "../src-derived/GenerateCode.hs" #-}
{-# LINE 861 "GenerateCode.ag" #-}
-- Lets or nested Cases?
-- or even a do-expression?
data DeclsType = DeclsLet | DeclsCase | DeclsDo
mkDecls :: DeclsType -> Decls -> Expr -> Expr
mkDecls DeclsLet = mkLet False
mkDecls DeclsCase = mkLet True
mkDecls DeclsDo = \decls -> Do (map toBind decls)
where toBind (Decl lhs rhs _ _) = BindLet lhs rhs
toBind d = d
mkLet :: Bool -> Decls -> Expr -> Expr
mkLet False decls body = Let decls body
mkLet True decls body = foldr oneCase body decls
oneCase :: Decl -> Expr -> Expr
oneCase (Decl left rhs _ _) exp = Case rhs [CaseAlt left exp]
oneCase _ exp = exp
-- Gives the name of the visit function
funname field 0 = show field ++ "_"
funname field nr = show field ++ "_" ++ show nr
-- Gives the name of a semantic function
seqSemname :: String -> NontermIdent -> ConstructorIdent -> Int -> String
seqSemname pre nt con 0 = semname pre nt con
seqSemname pre nt con nr = semname pre nt con ++ "_" ++ show nr
-- Gives the name of a type
typeName :: NontermIdent -> Int -> String
typeName nt 0 = "T_" ++ show nt
typeName nt n = "T_" ++ show nt ++ "_" ++ show n
ntOfVisit :: NontermIdent -> Int -> NontermIdent
ntOfVisit nt 0 = nt
ntOfVisit nt n = Ident (show nt ++ "_" ++ show n) (getPos nt)
-- Gives the name of a visit function
visitname :: String -> NontermIdent -> Int -> String
visitname pre nt n = pre ++ getName nt ++ "_" ++ show n
{-# LINE 245 "../src-derived/GenerateCode.hs" #-}
-- CGrammar ----------------------------------------------------
{-
visit 0:
inherited attribute:
options : Options
synthesized attributes:
errors : Seq Error
output : Program
alternatives:
alternative CGrammar:
child typeSyns : {TypeSyns}
child derivings : {Derivings}
child wrappers : {Set NontermIdent}
child nonts : CNonterminals
child pragmas : {PragmaMap}
child paramMap : {ParamMap}
child contextMap : {ContextMap}
child aroundsMap : {Map NontermIdent (Map ConstructorIdent (Set Identifier))}
visit 0:
local aroundMap : _
local unfoldSemDom : _
-}
-- cata
sem_CGrammar :: CGrammar ->
T_CGrammar
sem_CGrammar (CGrammar _typeSyns _derivings _wrappers _nonts _pragmas _paramMap _contextMap _aroundsMap ) =
(sem_CGrammar_CGrammar _typeSyns _derivings _wrappers (sem_CNonterminals _nonts ) _pragmas _paramMap _contextMap _aroundsMap )
-- semantic domain
newtype T_CGrammar = T_CGrammar (Options ->
( (Seq Error),Program))
data Inh_CGrammar = Inh_CGrammar {options_Inh_CGrammar :: !(Options)}
data Syn_CGrammar = Syn_CGrammar {errors_Syn_CGrammar :: !((Seq Error)),output_Syn_CGrammar :: !(Program)}
wrap_CGrammar :: T_CGrammar ->
Inh_CGrammar ->
Syn_CGrammar
wrap_CGrammar (T_CGrammar sem ) (Inh_CGrammar _lhsIoptions ) =
(let ( _lhsOerrors,_lhsOoutput) =
(sem _lhsIoptions )
in (Syn_CGrammar _lhsOerrors _lhsOoutput ))
sem_CGrammar_CGrammar :: TypeSyns ->
Derivings ->
(Set NontermIdent) ->
T_CNonterminals ->
PragmaMap ->
ParamMap ->
ContextMap ->
(Map NontermIdent (Map ConstructorIdent (Set Identifier))) ->
T_CGrammar
sem_CGrammar_CGrammar typeSyns_ derivings_ wrappers_ (T_CNonterminals nonts_ ) pragmas_ paramMap_ contextMap_ aroundsMap_ =
(T_CGrammar (\ _lhsIoptions ->
(let _nontsOo_sig :: Bool
_nontsOo_cata :: Bool
_nontsOo_sem :: Bool
_nontsOo_newtypes :: Bool
_nontsOo_unbox :: Bool
_nontsOo_case :: Bool
_nontsOo_pretty :: Bool
_nontsOo_rename :: Bool
_nontsOo_strictwrap :: Bool
_nontsOo_splitsems :: Bool
_nontsOo_data :: (Maybe Bool)
_nontsOprefix :: String
_nontsOo_traces :: Bool
_nontsOo_costcentre :: Bool
_nontsOo_linePragmas :: Bool
_nontsOo_monadic :: Bool
_nontsOallPragmas :: PragmaMap
_nontsOparamMap :: ParamMap
_nontsOcontextMap :: ContextMap
_nontsOallNts :: (Set NontermIdent)
_nontsOwith_sig :: Bool
_lhsOerrors :: (Seq Error)
_lhsOoutput :: Program
_nontsOtypeSyns :: TypeSyns
_nontsOderivings :: Derivings
_nontsOwrappers :: (Set NontermIdent)
_nontsOaroundMap :: (Map NontermIdent (Map ConstructorIdent (Set Identifier)))
_nontsOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_nontsIchunks :: Chunks
_nontsIgathNts :: (Set NontermIdent)
_nontsIsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_sig =
({-# LINE 50 "GenerateCode.ag" #-}
typeSigs _lhsIoptions
{-# LINE 331 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_cata =
({-# LINE 51 "GenerateCode.ag" #-}
folds _lhsIoptions
{-# LINE 336 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_sem =
({-# LINE 52 "GenerateCode.ag" #-}
semfuns _lhsIoptions
{-# LINE 341 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_newtypes =
({-# LINE 53 "GenerateCode.ag" #-}
newtypes _lhsIoptions
{-# LINE 346 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_unbox =
({-# LINE 54 "GenerateCode.ag" #-}
unbox _lhsIoptions
{-# LINE 351 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_case =
({-# LINE 55 "GenerateCode.ag" #-}
cases _lhsIoptions
{-# LINE 356 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_pretty =
({-# LINE 56 "GenerateCode.ag" #-}
attrInfo _lhsIoptions
{-# LINE 361 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_rename =
({-# LINE 57 "GenerateCode.ag" #-}
rename _lhsIoptions
{-# LINE 366 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_strictwrap =
({-# LINE 58 "GenerateCode.ag" #-}
strictWrap _lhsIoptions
{-# LINE 371 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_splitsems =
({-# LINE 59 "GenerateCode.ag" #-}
splitSems _lhsIoptions
{-# LINE 376 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_data =
({-# LINE 60 "GenerateCode.ag" #-}
if dataTypes _lhsIoptions then Just (strictData _lhsIoptions) else Nothing
{-# LINE 381 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOprefix =
({-# LINE 61 "GenerateCode.ag" #-}
prefix _lhsIoptions
{-# LINE 386 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_traces =
({-# LINE 62 "GenerateCode.ag" #-}
genTraces _lhsIoptions
{-# LINE 391 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_costcentre =
({-# LINE 63 "GenerateCode.ag" #-}
genCostCentres _lhsIoptions
{-# LINE 396 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_linePragmas =
({-# LINE 64 "GenerateCode.ag" #-}
genLinePragmas _lhsIoptions
{-# LINE 401 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 50, column 17)
_nontsOo_monadic =
({-# LINE 65 "GenerateCode.ag" #-}
monadic _lhsIoptions
{-# LINE 406 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 70, column 15)
_nontsOallPragmas =
({-# LINE 70 "GenerateCode.ag" #-}
pragmas_
{-# LINE 411 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 92, column 14)
_nontsOparamMap =
({-# LINE 92 "GenerateCode.ag" #-}
paramMap_
{-# LINE 416 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 113, column 7)
_nontsOcontextMap =
({-# LINE 113 "GenerateCode.ag" #-}
contextMap_
{-# LINE 421 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 125, column 7)
_nontsOallNts =
({-# LINE 125 "GenerateCode.ag" #-}
_nontsIgathNts
{-# LINE 426 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 539, column 34)
_aroundMap =
({-# LINE 539 "GenerateCode.ag" #-}
aroundsMap_
{-# LINE 431 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 680, column 7)
_unfoldSemDom =
({-# LINE 680 "GenerateCode.ag" #-}
\nt nr repl ->
let (params, tp) = Map.findWithDefault (error ("No such semantic domain: " ++ show nt)) (nt, nr) _nontsIsemDomUnfoldGath
replMap = Map.fromList (zip params repl)
replace k = Map.findWithDefault ('@':k) k replMap
in evalType replace tp
{-# LINE 440 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 779, column 14)
_nontsOwith_sig =
({-# LINE 779 "GenerateCode.ag" #-}
typeSigs _lhsIoptions
{-# LINE 445 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 782, column 15)
_lhsOerrors =
({-# LINE 782 "GenerateCode.ag" #-}
Seq.empty
{-# LINE 450 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 847, column 17)
_lhsOoutput =
({-# LINE 847 "GenerateCode.ag" #-}
Program _nontsIchunks
{-# LINE 455 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 911, column 14)
_nontsOtypeSyns =
({-# LINE 911 "GenerateCode.ag" #-}
typeSyns_
{-# LINE 460 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 911, column 14)
_nontsOderivings =
({-# LINE 912 "GenerateCode.ag" #-}
derivings_
{-# LINE 465 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 911, column 14)
_nontsOwrappers =
({-# LINE 913 "GenerateCode.ag" #-}
wrappers_
{-# LINE 470 "GenerateCode.hs" #-})
-- copy rule (from local)
_nontsOaroundMap =
({-# LINE 532 "GenerateCode.ag" #-}
_aroundMap
{-# LINE 475 "GenerateCode.hs" #-})
-- copy rule (from local)
_nontsOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_unfoldSemDom
{-# LINE 480 "GenerateCode.hs" #-})
( _nontsIchunks,_nontsIgathNts,_nontsIsemDomUnfoldGath) =
(nonts_ _nontsOallNts _nontsOallPragmas _nontsOaroundMap _nontsOcontextMap _nontsOderivings _nontsOo_case _nontsOo_cata _nontsOo_costcentre _nontsOo_data _nontsOo_linePragmas _nontsOo_monadic _nontsOo_newtypes _nontsOo_pretty _nontsOo_rename _nontsOo_sem _nontsOo_sig _nontsOo_splitsems _nontsOo_strictwrap _nontsOo_traces _nontsOo_unbox _nontsOparamMap _nontsOprefix _nontsOtypeSyns _nontsOunfoldSemDom _nontsOwith_sig _nontsOwrappers )
in ( _lhsOerrors,_lhsOoutput))) )
-- CInterface --------------------------------------------------
{-
visit 0:
inherited attributes:
inh : Attributes
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramMap : ParamMap
prefix : String
syn : Attributes
synthesized attributes:
comments : [String]
semDom : [Decl]
semDomUnfoldGath : Map (NontermIdent, Int) ([String], Code.Type)
wrapDecls : Decls
alternatives:
alternative CInterface:
child seg : CSegments
-}
-- cata
sem_CInterface :: CInterface ->
T_CInterface
sem_CInterface (CInterface _seg ) =
(sem_CInterface_CInterface (sem_CSegments _seg ) )
-- semantic domain
newtype T_CInterface = T_CInterface (Attributes ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
ParamMap ->
String ->
Attributes ->
( ([String]),([Decl]),(Map (NontermIdent, Int) ([String], Code.Type)),Decls))
data Inh_CInterface = Inh_CInterface {inh_Inh_CInterface :: !(Attributes),nt_Inh_CInterface :: !(NontermIdent),o_case_Inh_CInterface :: !(Bool),o_cata_Inh_CInterface :: !(Bool),o_costcentre_Inh_CInterface :: !(Bool),o_data_Inh_CInterface :: !((Maybe Bool)),o_linePragmas_Inh_CInterface :: !(Bool),o_monadic_Inh_CInterface :: !(Bool),o_newtypes_Inh_CInterface :: !(Bool),o_pretty_Inh_CInterface :: !(Bool),o_rename_Inh_CInterface :: !(Bool),o_sem_Inh_CInterface :: !(Bool),o_sig_Inh_CInterface :: !(Bool),o_splitsems_Inh_CInterface :: !(Bool),o_strictwrap_Inh_CInterface :: !(Bool),o_traces_Inh_CInterface :: !(Bool),o_unbox_Inh_CInterface :: !(Bool),paramMap_Inh_CInterface :: !(ParamMap),prefix_Inh_CInterface :: !(String),syn_Inh_CInterface :: !(Attributes)}
data Syn_CInterface = Syn_CInterface {comments_Syn_CInterface :: !(([String])),semDom_Syn_CInterface :: !(([Decl])),semDomUnfoldGath_Syn_CInterface :: !((Map (NontermIdent, Int) ([String], Code.Type))),wrapDecls_Syn_CInterface :: !(Decls)}
wrap_CInterface :: T_CInterface ->
Inh_CInterface ->
Syn_CInterface
wrap_CInterface (T_CInterface sem ) (Inh_CInterface _lhsIinh _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn ) =
(let ( _lhsOcomments,_lhsOsemDom,_lhsOsemDomUnfoldGath,_lhsOwrapDecls) =
(sem _lhsIinh _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn )
in (Syn_CInterface _lhsOcomments _lhsOsemDom _lhsOsemDomUnfoldGath _lhsOwrapDecls ))
sem_CInterface_CInterface :: T_CSegments ->
T_CInterface
sem_CInterface_CInterface (T_CSegments seg_ ) =
(T_CInterface (\ _lhsIinh
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsIsyn ->
(let _segOnr :: Int
_lhsOsemDom :: ([Decl])
_lhsOcomments :: ([String])
_lhsOsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_lhsOwrapDecls :: Decls
_segOinh :: Attributes
_segOnt :: NontermIdent
_segOo_case :: Bool
_segOo_cata :: Bool
_segOo_costcentre :: Bool
_segOo_data :: (Maybe Bool)
_segOo_linePragmas :: Bool
_segOo_monadic :: Bool
_segOo_newtypes :: Bool
_segOo_pretty :: Bool
_segOo_rename :: Bool
_segOo_sem :: Bool
_segOo_sig :: Bool
_segOo_splitsems :: Bool
_segOo_strictwrap :: Bool
_segOo_traces :: Bool
_segOo_unbox :: Bool
_segOparamMap :: ParamMap
_segOprefix :: String
_segOsyn :: Attributes
_segIcomments :: ([String])
_segIisNil :: Bool
_segIsemDom :: ([Decl])
_segIsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_segIwrapDecls :: Decls
-- "GenerateCode.ag"(line 246, column 17)
_segOnr =
({-# LINE 246 "GenerateCode.ag" #-}
0
{-# LINE 610 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 653, column 18)
_lhsOsemDom =
({-# LINE 653 "GenerateCode.ag" #-}
Comment "semantic domain" : _segIsemDom
{-# LINE 615 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
_segIcomments
{-# LINE 620 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 670, column 86)
_lhsOsemDomUnfoldGath =
({-# LINE 670 "GenerateCode.ag" #-}
_segIsemDomUnfoldGath
{-# LINE 625 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 756, column 52)
_lhsOwrapDecls =
({-# LINE 756 "GenerateCode.ag" #-}
_segIwrapDecls
{-# LINE 630 "GenerateCode.hs" #-})
-- copy rule (down)
_segOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 635 "GenerateCode.hs" #-})
-- copy rule (down)
_segOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 640 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 645 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 650 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 655 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 660 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 665 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 670 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 675 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 680 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 685 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 690 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 695 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 700 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 705 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 710 "GenerateCode.hs" #-})
-- copy rule (down)
_segOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 715 "GenerateCode.hs" #-})
-- copy rule (down)
_segOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 720 "GenerateCode.hs" #-})
-- copy rule (down)
_segOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 725 "GenerateCode.hs" #-})
-- copy rule (down)
_segOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 730 "GenerateCode.hs" #-})
( _segIcomments,_segIisNil,_segIsemDom,_segIsemDomUnfoldGath,_segIwrapDecls) =
(seg_ _segOinh _segOnr _segOnt _segOo_case _segOo_cata _segOo_costcentre _segOo_data _segOo_linePragmas _segOo_monadic _segOo_newtypes _segOo_pretty _segOo_rename _segOo_sem _segOo_sig _segOo_splitsems _segOo_strictwrap _segOo_traces _segOo_unbox _segOparamMap _segOprefix _segOsyn )
in ( _lhsOcomments,_lhsOsemDom,_lhsOsemDomUnfoldGath,_lhsOwrapDecls))) )
-- CNonterminal ------------------------------------------------
{-
visit 0:
inherited attributes:
allNts : Set NontermIdent
allPragmas : PragmaMap
aroundMap : Map NontermIdent (Map ConstructorIdent (Set Identifier))
contextMap : ContextMap
derivings : Derivings
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramMap : ParamMap
prefix : String
typeSyns : TypeSyns
unfoldSemDom : NontermIdent -> Int -> [String] -> Code.Type
with_sig : Bool
wrappers : Set NontermIdent
synthesized attributes:
chunks : Chunks
gathNts : Set NontermIdent
semDomUnfoldGath : Map (NontermIdent, Int) ([String], Code.Type)
alternatives:
alternative CNonterminal:
child nt : {NontermIdent}
child params : {[Identifier]}
child inh : {Attributes}
child syn : {Attributes}
child prods : CProductions
child inter : CInterface
visit 0:
local _tup1 : {(Attributes,Attributes,NontermIdent)}
local _tup2 : {(Attributes,Attributes,NontermIdent)}
local aroundMap : _
local semWrapper : _
local comment : _
local dataDef : _
local cataFun : _
-}
-- cata
sem_CNonterminal :: CNonterminal ->
T_CNonterminal
sem_CNonterminal (CNonterminal _nt _params _inh _syn _prods _inter ) =
(sem_CNonterminal_CNonterminal _nt _params _inh _syn (sem_CProductions _prods ) (sem_CInterface _inter ) )
-- semantic domain
newtype T_CNonterminal = T_CNonterminal ((Set NontermIdent) ->
PragmaMap ->
(Map NontermIdent (Map ConstructorIdent (Set Identifier))) ->
ContextMap ->
Derivings ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
ParamMap ->
String ->
TypeSyns ->
(NontermIdent -> Int -> [String] -> Code.Type) ->
Bool ->
(Set NontermIdent) ->
( Chunks,(Set NontermIdent),(Map (NontermIdent, Int) ([String], Code.Type))))
data Inh_CNonterminal = Inh_CNonterminal {allNts_Inh_CNonterminal :: !((Set NontermIdent)),allPragmas_Inh_CNonterminal :: !(PragmaMap),aroundMap_Inh_CNonterminal :: !((Map NontermIdent (Map ConstructorIdent (Set Identifier)))),contextMap_Inh_CNonterminal :: !(ContextMap),derivings_Inh_CNonterminal :: !(Derivings),o_case_Inh_CNonterminal :: !(Bool),o_cata_Inh_CNonterminal :: !(Bool),o_costcentre_Inh_CNonterminal :: !(Bool),o_data_Inh_CNonterminal :: !((Maybe Bool)),o_linePragmas_Inh_CNonterminal :: !(Bool),o_monadic_Inh_CNonterminal :: !(Bool),o_newtypes_Inh_CNonterminal :: !(Bool),o_pretty_Inh_CNonterminal :: !(Bool),o_rename_Inh_CNonterminal :: !(Bool),o_sem_Inh_CNonterminal :: !(Bool),o_sig_Inh_CNonterminal :: !(Bool),o_splitsems_Inh_CNonterminal :: !(Bool),o_strictwrap_Inh_CNonterminal :: !(Bool),o_traces_Inh_CNonterminal :: !(Bool),o_unbox_Inh_CNonterminal :: !(Bool),paramMap_Inh_CNonterminal :: !(ParamMap),prefix_Inh_CNonterminal :: !(String),typeSyns_Inh_CNonterminal :: !(TypeSyns),unfoldSemDom_Inh_CNonterminal :: !((NontermIdent -> Int -> [String] -> Code.Type)),with_sig_Inh_CNonterminal :: !(Bool),wrappers_Inh_CNonterminal :: !((Set NontermIdent))}
data Syn_CNonterminal = Syn_CNonterminal {chunks_Syn_CNonterminal :: !(Chunks),gathNts_Syn_CNonterminal :: !((Set NontermIdent)),semDomUnfoldGath_Syn_CNonterminal :: !((Map (NontermIdent, Int) ([String], Code.Type)))}
wrap_CNonterminal :: T_CNonterminal ->
Inh_CNonterminal ->
Syn_CNonterminal
wrap_CNonterminal (T_CNonterminal sem ) (Inh_CNonterminal _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIcontextMap _lhsIderivings _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsItypeSyns _lhsIunfoldSemDom _lhsIwith_sig _lhsIwrappers ) =
(let ( _lhsOchunks,_lhsOgathNts,_lhsOsemDomUnfoldGath) =
(sem _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIcontextMap _lhsIderivings _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsItypeSyns _lhsIunfoldSemDom _lhsIwith_sig _lhsIwrappers )
in (Syn_CNonterminal _lhsOchunks _lhsOgathNts _lhsOsemDomUnfoldGath ))
sem_CNonterminal_CNonterminal :: NontermIdent ->
([Identifier]) ->
Attributes ->
Attributes ->
T_CProductions ->
T_CInterface ->
T_CNonterminal
sem_CNonterminal_CNonterminal nt_ params_ inh_ syn_ (T_CProductions prods_ ) (T_CInterface inter_ ) =
(T_CNonterminal (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIcontextMap
_lhsIderivings
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsItypeSyns
_lhsIunfoldSemDom
_lhsIwith_sig
_lhsIwrappers ->
(let __tup1 :: ((Attributes,Attributes,NontermIdent))
_interOinh :: Attributes
_interOsyn :: Attributes
_interOnt :: NontermIdent
__tup2 :: ((Attributes,Attributes,NontermIdent))
_prodsOinh :: Attributes
_prodsOsyn :: Attributes
_prodsOnt :: NontermIdent
_lhsOgathNts :: (Set NontermIdent)
_lhsOchunks :: Chunks
_lhsOsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_prodsOallNts :: (Set NontermIdent)
_prodsOallPragmas :: PragmaMap
_prodsOaroundMap :: (Map ConstructorIdent (Set Identifier))
_prodsOcontextMap :: ContextMap
_prodsOo_case :: Bool
_prodsOo_cata :: Bool
_prodsOo_costcentre :: Bool
_prodsOo_data :: (Maybe Bool)
_prodsOo_linePragmas :: Bool
_prodsOo_monadic :: Bool
_prodsOo_newtypes :: Bool
_prodsOo_pretty :: Bool
_prodsOo_rename :: Bool
_prodsOo_sem :: Bool
_prodsOo_sig :: Bool
_prodsOo_splitsems :: Bool
_prodsOo_strictwrap :: Bool
_prodsOo_traces :: Bool
_prodsOo_unbox :: Bool
_prodsOparamMap :: ParamMap
_prodsOprefix :: String
_prodsOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_prodsOwith_sig :: Bool
_interOo_case :: Bool
_interOo_cata :: Bool
_interOo_costcentre :: Bool
_interOo_data :: (Maybe Bool)
_interOo_linePragmas :: Bool
_interOo_monadic :: Bool
_interOo_newtypes :: Bool
_interOo_pretty :: Bool
_interOo_rename :: Bool
_interOo_sem :: Bool
_interOo_sig :: Bool
_interOo_splitsems :: Bool
_interOo_strictwrap :: Bool
_interOo_traces :: Bool
_interOo_unbox :: Bool
_interOparamMap :: ParamMap
_interOprefix :: String
_prodsIcataAlts :: Decls
_prodsIcomments :: ([String])
_prodsIdataAlts :: DataAlts
_prodsIdecls :: Decls
_prodsIsemNames :: ([String])
_interIcomments :: ([String])
_interIsemDom :: ([Decl])
_interIsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_interIwrapDecls :: Decls
-- "GenerateCode.ag"(line 80, column 26)
__tup1 =
({-# LINE 80 "GenerateCode.ag" #-}
(inh_,syn_,nt_)
{-# LINE 925 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 80, column 26)
(_interOinh,_,_) =
({-# LINE 80 "GenerateCode.ag" #-}
__tup1
{-# LINE 930 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 80, column 26)
(_,_interOsyn,_) =
({-# LINE 80 "GenerateCode.ag" #-}
__tup1
{-# LINE 935 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 80, column 26)
(_,_,_interOnt) =
({-# LINE 80 "GenerateCode.ag" #-}
__tup1
{-# LINE 940 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 81, column 25)
__tup2 =
({-# LINE 81 "GenerateCode.ag" #-}
(inh_,syn_,nt_)
{-# LINE 945 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 81, column 25)
(_prodsOinh,_,_) =
({-# LINE 81 "GenerateCode.ag" #-}
__tup2
{-# LINE 950 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 81, column 25)
(_,_prodsOsyn,_) =
({-# LINE 81 "GenerateCode.ag" #-}
__tup2
{-# LINE 955 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 81, column 25)
(_,_,_prodsOnt) =
({-# LINE 81 "GenerateCode.ag" #-}
__tup2
{-# LINE 960 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 131, column 7)
_lhsOgathNts =
({-# LINE 131 "GenerateCode.ag" #-}
Set.singleton nt_
{-# LINE 965 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 540, column 34)
_aroundMap =
({-# LINE 540 "GenerateCode.ag" #-}
Map.findWithDefault Map.empty nt_ _lhsIaroundMap
{-# LINE 970 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 730, column 18)
_semWrapper =
({-# LINE 730 "GenerateCode.ag" #-}
let params' = map getName params_
inhAttrs = Map.toList inh_
synAttrs = Map.toList syn_
inhVars = [ SimpleExpr (attrname True _LHS a) | (a,_) <- inhAttrs ]
synVars = [ SimpleExpr (attrname False _LHS a) | (a,_) <- synAttrs ]
var = "sem"
wrapNT = "wrap" ++ "_" ++ getName nt_
inhNT = "Inh" ++ "_" ++ getName nt_
synNT = "Syn" ++ "_" ++ getName nt_
varPat = if _lhsIo_newtypes
then App (sdtype nt_) [SimpleExpr var]
else SimpleExpr var
evalTp | null params' = id
| otherwise = idEvalType
appParams nm = TypeApp (SimpleType nm) (map SimpleType params')
typeSig = TSig wrapNT (evalTp $ appParams (sdtype nt_) `Arr` (appParams inhNT `Arr` appParams synNT))
mkstrict = Named _lhsIo_strictwrap
mkdata n attrs = Data n params' [Record n [mkstrict (getName f++"_"++n) $ evalTp $ typeToCodeType (Just nt_) params' t | (f,t) <- attrs]] False []
datas = [mkdata inhNT inhAttrs, mkdata synNT synAttrs]
in datas ++ [ typeSig
, Decl (Fun wrapNT [varPat, App inhNT inhVars])
(Let _interIwrapDecls (App synNT synVars))
Set.empty Set.empty
]
{-# LINE 998 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 789, column 18)
_comment =
({-# LINE 789 "GenerateCode.ag" #-}
Comment . unlines . map ind $ ( _interIcomments ++ ("alternatives:" : map ind _prodsIcomments) )
{-# LINE 1003 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 850, column 19)
_lhsOchunks =
({-# LINE 850 "GenerateCode.ag" #-}
[ Chunk (getName nt_)
(Comment (getName nt_ ++ " " ++ replicate (60 - length (getName nt_)) '-'))
(if _lhsIo_pretty then [_comment ] else [])
(if isJust _lhsIo_data then [_dataDef ] else [])
(if _lhsIo_cata then _cataFun else [])
(if _lhsIo_sig then _interIsemDom else [])
(if nt_ `Set.member` _lhsIwrappers then _semWrapper else [])
(if _lhsIo_sem then _prodsIdecls else [])
(if _lhsIo_sem then _prodsIsemNames else [])
]
{-# LINE 1017 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 916, column 18)
_dataDef =
({-# LINE 916 "GenerateCode.ag" #-}
let params' = map getName params_
typeSyn tp = let theType =
case tp of
CommonTypes.Maybe t -> TMaybe $ typeToCodeType (Just nt_) params' t
CommonTypes.Either t1 t2 -> TEither (typeToCodeType (Just nt_) params' t1) (typeToCodeType (Just nt_) params' t2)
CommonTypes.Map t1 t2 -> TMap (typeToCodeType (Just nt_) params' t1) (typeToCodeType (Just nt_) params' t2)
CommonTypes.IntMap t -> TIntMap $ typeToCodeType (Just nt_) params' t
CommonTypes.List t -> Code.List $ typeToCodeType (Just nt_) params' t
CommonTypes.Tuple ts -> Code.TupleType [typeToCodeType (Just nt_) params' t
| (_,t) <- ts
]
in Code.Type (getName nt_) params' (idEvalType theType)
derivings = maybe [] (map getName . Set.toList) (Map.lookup nt_ _lhsIderivings)
dataDef = Data (getName nt_) (map getName params_) _prodsIdataAlts (maybe False id _lhsIo_data) derivings
in maybe dataDef typeSyn $ lookup nt_ _lhsItypeSyns
{-# LINE 1036 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 948, column 18)
_cataFun =
({-# LINE 948 "GenerateCode.ag" #-}
let appParams nm = TypeApp (SimpleType nm) (map SimpleType (map getName params_))
evalTp | null params_ = id
| otherwise = idEvalType
tSig = TSig (cataname _lhsIprefix nt_)
(appContext _lhsIcontextMap nt_ $ evalTp $ appParams (getName nt_) `Arr` appParams (sdtype nt_))
special typ = case typ of
CommonTypes.List tp ->
let cons = SimpleExpr (semname _lhsIprefix nt_ (identifier "Cons"))
nil = SimpleExpr (semname _lhsIprefix nt_ (identifier "Nil" ))
arg = SimpleExpr "list"
rarg = case tp of
NT t _ -> let t' = maybe t id (deforestedNt t)
in SimpleExpr ("(Prelude.map " ++ (cataname _lhsIprefix t') ++ " list)")
_ -> arg
lhs = Fun (cataname _lhsIprefix nt_) [arg]
rhs = (App "Prelude.foldr" [cons,nil,rarg])
in [Decl lhs rhs Set.empty Set.empty]
CommonTypes.Maybe tp ->
let just = semname _lhsIprefix nt_ (identifier "Just")
nothing = semname _lhsIprefix nt_ (identifier "Nothing" )
arg = SimpleExpr "x"
rarg = case tp of
NT t _ -> let t' = maybe t id (deforestedNt t)
in App (cataname _lhsIprefix t') [arg]
_ -> arg
lhs a = Fun (cataname _lhsIprefix nt_) [a]
in [Decl (lhs (App "Prelude.Just" [arg])) (App just [rarg]) Set.empty Set.empty
,Decl (lhs (SimpleExpr "Prelude.Nothing")) (SimpleExpr nothing) Set.empty Set.empty
]
CommonTypes.Either tp1 tp2 ->
let left = semname _lhsIprefix nt_ (identifier "Left")
right = semname _lhsIprefix nt_ (identifier "Right" )
arg = SimpleExpr "x"
rarg0 = case tp1 of
NT t _ -> let t' = maybe t id (deforestedNt t)
in App (cataname _lhsIprefix t') [arg]
_ -> arg
rarg1 = case tp2 of
NT t _ -> let t' = maybe t id (deforestedNt t)
in App (cataname _lhsIprefix t') [arg]
_ -> arg
lhs a = Fun (cataname _lhsIprefix nt_) [a]
in [Decl (lhs (App "Prelude.Left" [arg])) (App left [rarg0]) Set.empty Set.empty
,Decl (lhs (App "Prelude.Right" [arg])) (App right [rarg1]) Set.empty Set.empty
]
CommonTypes.Map _ tp ->
let entry = SimpleExpr (semname _lhsIprefix nt_ (identifier "Entry"))
nil = SimpleExpr (semname _lhsIprefix nt_ (identifier "Nil"))
arg = SimpleExpr "m"
rarg = case tp of
NT t _ -> let t' = maybe t id (deforestedNt t)
in App "Map.map" [SimpleExpr $ cataname _lhsIprefix t', arg]
_ -> arg
lhs = Fun (cataname _lhsIprefix nt_) [arg]
rhs = App "Map.foldWithKey" [entry,nil,rarg]
in [Decl lhs rhs Set.empty Set.empty]
CommonTypes.IntMap tp ->
let entry = SimpleExpr (semname _lhsIprefix nt_ (identifier "Entry"))
nil = SimpleExpr (semname _lhsIprefix nt_ (identifier "Nil"))
arg = SimpleExpr "m"
rarg = case tp of
NT t _ -> let t' = maybe t id (deforestedNt t)
in App "IntMap.map" [SimpleExpr $ cataname _lhsIprefix t', arg]
_ -> arg
lhs = Fun (cataname _lhsIprefix nt_) [arg]
rhs = App "IntMap.foldWithKey" [entry,nil,rarg]
in [Decl lhs rhs Set.empty Set.empty]
CommonTypes.Tuple tps ->
let con = semname _lhsIprefix nt_ (identifier "Tuple")
tps' = [ (SimpleExpr (getName x),y) | (x,y) <- tps]
rargs = map rarg tps'
rarg (n, tp) = case tp of
NT t _ -> let t' = maybe t id (deforestedNt t)
in App (cataname _lhsIprefix t') [n]
_ -> n
lhs = Fun (cataname _lhsIprefix nt_) [TupleExpr (map fst tps')]
rhs = App con rargs
in [Decl lhs rhs Set.empty Set.empty]
in Comment "cata" :
(if _lhsIo_sig then [tSig] else []) ++
maybe _prodsIcataAlts special (lookup nt_ _lhsItypeSyns)
{-# LINE 1121 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 670, column 86)
_lhsOsemDomUnfoldGath =
({-# LINE 670 "GenerateCode.ag" #-}
_interIsemDomUnfoldGath
{-# LINE 1126 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 1131 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOallPragmas =
({-# LINE 67 "GenerateCode.ag" #-}
_lhsIallPragmas
{-# LINE 1136 "GenerateCode.hs" #-})
-- copy rule (from local)
_prodsOaroundMap =
({-# LINE 535 "GenerateCode.ag" #-}
_aroundMap
{-# LINE 1141 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOcontextMap =
({-# LINE 109 "GenerateCode.ag" #-}
_lhsIcontextMap
{-# LINE 1146 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 1151 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 1156 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 1161 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 1166 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 1171 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 1176 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 1181 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 1186 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 1191 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 1196 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 1201 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 1206 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 1211 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 1216 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 1221 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 1226 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 1231 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 1236 "GenerateCode.hs" #-})
-- copy rule (down)
_prodsOwith_sig =
({-# LINE 776 "GenerateCode.ag" #-}
_lhsIwith_sig
{-# LINE 1241 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 1246 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 1251 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 1256 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 1261 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 1266 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 1271 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 1276 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 1281 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 1286 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 1291 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 1296 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 1301 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 1306 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 1311 "GenerateCode.hs" #-})
-- copy rule (down)
_interOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 1316 "GenerateCode.hs" #-})
-- copy rule (down)
_interOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 1321 "GenerateCode.hs" #-})
-- copy rule (down)
_interOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 1326 "GenerateCode.hs" #-})
( _prodsIcataAlts,_prodsIcomments,_prodsIdataAlts,_prodsIdecls,_prodsIsemNames) =
(prods_ _prodsOallNts _prodsOallPragmas _prodsOaroundMap _prodsOcontextMap _prodsOinh _prodsOnt _prodsOo_case _prodsOo_cata _prodsOo_costcentre _prodsOo_data _prodsOo_linePragmas _prodsOo_monadic _prodsOo_newtypes _prodsOo_pretty _prodsOo_rename _prodsOo_sem _prodsOo_sig _prodsOo_splitsems _prodsOo_strictwrap _prodsOo_traces _prodsOo_unbox _prodsOparamMap _prodsOprefix _prodsOsyn _prodsOunfoldSemDom _prodsOwith_sig )
( _interIcomments,_interIsemDom,_interIsemDomUnfoldGath,_interIwrapDecls) =
(inter_ _interOinh _interOnt _interOo_case _interOo_cata _interOo_costcentre _interOo_data _interOo_linePragmas _interOo_monadic _interOo_newtypes _interOo_pretty _interOo_rename _interOo_sem _interOo_sig _interOo_splitsems _interOo_strictwrap _interOo_traces _interOo_unbox _interOparamMap _interOprefix _interOsyn )
in ( _lhsOchunks,_lhsOgathNts,_lhsOsemDomUnfoldGath))) )
-- CNonterminals -----------------------------------------------
{-
visit 0:
inherited attributes:
allNts : Set NontermIdent
allPragmas : PragmaMap
aroundMap : Map NontermIdent (Map ConstructorIdent (Set Identifier))
contextMap : ContextMap
derivings : Derivings
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramMap : ParamMap
prefix : String
typeSyns : TypeSyns
unfoldSemDom : NontermIdent -> Int -> [String] -> Code.Type
with_sig : Bool
wrappers : Set NontermIdent
synthesized attributes:
chunks : Chunks
gathNts : Set NontermIdent
semDomUnfoldGath : Map (NontermIdent, Int) ([String], Code.Type)
alternatives:
alternative Cons:
child hd : CNonterminal
child tl : CNonterminals
alternative Nil:
-}
-- cata
sem_CNonterminals :: CNonterminals ->
T_CNonterminals
sem_CNonterminals list =
(Prelude.foldr sem_CNonterminals_Cons sem_CNonterminals_Nil (Prelude.map sem_CNonterminal list) )
-- semantic domain
newtype T_CNonterminals = T_CNonterminals ((Set NontermIdent) ->
PragmaMap ->
(Map NontermIdent (Map ConstructorIdent (Set Identifier))) ->
ContextMap ->
Derivings ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
ParamMap ->
String ->
TypeSyns ->
(NontermIdent -> Int -> [String] -> Code.Type) ->
Bool ->
(Set NontermIdent) ->
( Chunks,(Set NontermIdent),(Map (NontermIdent, Int) ([String], Code.Type))))
data Inh_CNonterminals = Inh_CNonterminals {allNts_Inh_CNonterminals :: !((Set NontermIdent)),allPragmas_Inh_CNonterminals :: !(PragmaMap),aroundMap_Inh_CNonterminals :: !((Map NontermIdent (Map ConstructorIdent (Set Identifier)))),contextMap_Inh_CNonterminals :: !(ContextMap),derivings_Inh_CNonterminals :: !(Derivings),o_case_Inh_CNonterminals :: !(Bool),o_cata_Inh_CNonterminals :: !(Bool),o_costcentre_Inh_CNonterminals :: !(Bool),o_data_Inh_CNonterminals :: !((Maybe Bool)),o_linePragmas_Inh_CNonterminals :: !(Bool),o_monadic_Inh_CNonterminals :: !(Bool),o_newtypes_Inh_CNonterminals :: !(Bool),o_pretty_Inh_CNonterminals :: !(Bool),o_rename_Inh_CNonterminals :: !(Bool),o_sem_Inh_CNonterminals :: !(Bool),o_sig_Inh_CNonterminals :: !(Bool),o_splitsems_Inh_CNonterminals :: !(Bool),o_strictwrap_Inh_CNonterminals :: !(Bool),o_traces_Inh_CNonterminals :: !(Bool),o_unbox_Inh_CNonterminals :: !(Bool),paramMap_Inh_CNonterminals :: !(ParamMap),prefix_Inh_CNonterminals :: !(String),typeSyns_Inh_CNonterminals :: !(TypeSyns),unfoldSemDom_Inh_CNonterminals :: !((NontermIdent -> Int -> [String] -> Code.Type)),with_sig_Inh_CNonterminals :: !(Bool),wrappers_Inh_CNonterminals :: !((Set NontermIdent))}
data Syn_CNonterminals = Syn_CNonterminals {chunks_Syn_CNonterminals :: !(Chunks),gathNts_Syn_CNonterminals :: !((Set NontermIdent)),semDomUnfoldGath_Syn_CNonterminals :: !((Map (NontermIdent, Int) ([String], Code.Type)))}
wrap_CNonterminals :: T_CNonterminals ->
Inh_CNonterminals ->
Syn_CNonterminals
wrap_CNonterminals (T_CNonterminals sem ) (Inh_CNonterminals _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIcontextMap _lhsIderivings _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsItypeSyns _lhsIunfoldSemDom _lhsIwith_sig _lhsIwrappers ) =
(let ( _lhsOchunks,_lhsOgathNts,_lhsOsemDomUnfoldGath) =
(sem _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIcontextMap _lhsIderivings _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsItypeSyns _lhsIunfoldSemDom _lhsIwith_sig _lhsIwrappers )
in (Syn_CNonterminals _lhsOchunks _lhsOgathNts _lhsOsemDomUnfoldGath ))
sem_CNonterminals_Cons :: T_CNonterminal ->
T_CNonterminals ->
T_CNonterminals
sem_CNonterminals_Cons (T_CNonterminal hd_ ) (T_CNonterminals tl_ ) =
(T_CNonterminals (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIcontextMap
_lhsIderivings
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsItypeSyns
_lhsIunfoldSemDom
_lhsIwith_sig
_lhsIwrappers ->
(let _lhsOchunks :: Chunks
_lhsOgathNts :: (Set NontermIdent)
_lhsOsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_hdOallNts :: (Set NontermIdent)
_hdOallPragmas :: PragmaMap
_hdOaroundMap :: (Map NontermIdent (Map ConstructorIdent (Set Identifier)))
_hdOcontextMap :: ContextMap
_hdOderivings :: Derivings
_hdOo_case :: Bool
_hdOo_cata :: Bool
_hdOo_costcentre :: Bool
_hdOo_data :: (Maybe Bool)
_hdOo_linePragmas :: Bool
_hdOo_monadic :: Bool
_hdOo_newtypes :: Bool
_hdOo_pretty :: Bool
_hdOo_rename :: Bool
_hdOo_sem :: Bool
_hdOo_sig :: Bool
_hdOo_splitsems :: Bool
_hdOo_strictwrap :: Bool
_hdOo_traces :: Bool
_hdOo_unbox :: Bool
_hdOparamMap :: ParamMap
_hdOprefix :: String
_hdOtypeSyns :: TypeSyns
_hdOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_hdOwith_sig :: Bool
_hdOwrappers :: (Set NontermIdent)
_tlOallNts :: (Set NontermIdent)
_tlOallPragmas :: PragmaMap
_tlOaroundMap :: (Map NontermIdent (Map ConstructorIdent (Set Identifier)))
_tlOcontextMap :: ContextMap
_tlOderivings :: Derivings
_tlOo_case :: Bool
_tlOo_cata :: Bool
_tlOo_costcentre :: Bool
_tlOo_data :: (Maybe Bool)
_tlOo_linePragmas :: Bool
_tlOo_monadic :: Bool
_tlOo_newtypes :: Bool
_tlOo_pretty :: Bool
_tlOo_rename :: Bool
_tlOo_sem :: Bool
_tlOo_sig :: Bool
_tlOo_splitsems :: Bool
_tlOo_strictwrap :: Bool
_tlOo_traces :: Bool
_tlOo_unbox :: Bool
_tlOparamMap :: ParamMap
_tlOprefix :: String
_tlOtypeSyns :: TypeSyns
_tlOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_tlOwith_sig :: Bool
_tlOwrappers :: (Set NontermIdent)
_hdIchunks :: Chunks
_hdIgathNts :: (Set NontermIdent)
_hdIsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_tlIchunks :: Chunks
_tlIgathNts :: (Set NontermIdent)
_tlIsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
-- use rule "GenerateCode.ag"(line 842, column 49)
_lhsOchunks =
({-# LINE 842 "GenerateCode.ag" #-}
_hdIchunks ++ _tlIchunks
{-# LINE 1509 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 127, column 47)
_lhsOgathNts =
({-# LINE 127 "GenerateCode.ag" #-}
_hdIgathNts `Set.union` _tlIgathNts
{-# LINE 1514 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 670, column 86)
_lhsOsemDomUnfoldGath =
({-# LINE 670 "GenerateCode.ag" #-}
_hdIsemDomUnfoldGath `Map.union` _tlIsemDomUnfoldGath
{-# LINE 1519 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 1524 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOallPragmas =
({-# LINE 67 "GenerateCode.ag" #-}
_lhsIallPragmas
{-# LINE 1529 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOaroundMap =
({-# LINE 532 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 1534 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOcontextMap =
({-# LINE 109 "GenerateCode.ag" #-}
_lhsIcontextMap
{-# LINE 1539 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOderivings =
({-# LINE 909 "GenerateCode.ag" #-}
_lhsIderivings
{-# LINE 1544 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 1549 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 1554 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 1559 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 1564 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 1569 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 1574 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 1579 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 1584 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 1589 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 1594 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 1599 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 1604 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 1609 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 1614 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 1619 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 1624 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 1629 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOtypeSyns =
({-# LINE 909 "GenerateCode.ag" #-}
_lhsItypeSyns
{-# LINE 1634 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 1639 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOwith_sig =
({-# LINE 776 "GenerateCode.ag" #-}
_lhsIwith_sig
{-# LINE 1644 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOwrappers =
({-# LINE 909 "GenerateCode.ag" #-}
_lhsIwrappers
{-# LINE 1649 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 1654 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOallPragmas =
({-# LINE 67 "GenerateCode.ag" #-}
_lhsIallPragmas
{-# LINE 1659 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOaroundMap =
({-# LINE 532 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 1664 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOcontextMap =
({-# LINE 109 "GenerateCode.ag" #-}
_lhsIcontextMap
{-# LINE 1669 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOderivings =
({-# LINE 909 "GenerateCode.ag" #-}
_lhsIderivings
{-# LINE 1674 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 1679 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 1684 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 1689 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 1694 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 1699 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 1704 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 1709 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 1714 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 1719 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 1724 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 1729 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 1734 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 1739 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 1744 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 1749 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 1754 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 1759 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOtypeSyns =
({-# LINE 909 "GenerateCode.ag" #-}
_lhsItypeSyns
{-# LINE 1764 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 1769 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOwith_sig =
({-# LINE 776 "GenerateCode.ag" #-}
_lhsIwith_sig
{-# LINE 1774 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOwrappers =
({-# LINE 909 "GenerateCode.ag" #-}
_lhsIwrappers
{-# LINE 1779 "GenerateCode.hs" #-})
( _hdIchunks,_hdIgathNts,_hdIsemDomUnfoldGath) =
(hd_ _hdOallNts _hdOallPragmas _hdOaroundMap _hdOcontextMap _hdOderivings _hdOo_case _hdOo_cata _hdOo_costcentre _hdOo_data _hdOo_linePragmas _hdOo_monadic _hdOo_newtypes _hdOo_pretty _hdOo_rename _hdOo_sem _hdOo_sig _hdOo_splitsems _hdOo_strictwrap _hdOo_traces _hdOo_unbox _hdOparamMap _hdOprefix _hdOtypeSyns _hdOunfoldSemDom _hdOwith_sig _hdOwrappers )
( _tlIchunks,_tlIgathNts,_tlIsemDomUnfoldGath) =
(tl_ _tlOallNts _tlOallPragmas _tlOaroundMap _tlOcontextMap _tlOderivings _tlOo_case _tlOo_cata _tlOo_costcentre _tlOo_data _tlOo_linePragmas _tlOo_monadic _tlOo_newtypes _tlOo_pretty _tlOo_rename _tlOo_sem _tlOo_sig _tlOo_splitsems _tlOo_strictwrap _tlOo_traces _tlOo_unbox _tlOparamMap _tlOprefix _tlOtypeSyns _tlOunfoldSemDom _tlOwith_sig _tlOwrappers )
in ( _lhsOchunks,_lhsOgathNts,_lhsOsemDomUnfoldGath))) )
sem_CNonterminals_Nil :: T_CNonterminals
sem_CNonterminals_Nil =
(T_CNonterminals (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIcontextMap
_lhsIderivings
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsItypeSyns
_lhsIunfoldSemDom
_lhsIwith_sig
_lhsIwrappers ->
(let _lhsOchunks :: Chunks
_lhsOgathNts :: (Set NontermIdent)
_lhsOsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
-- use rule "GenerateCode.ag"(line 842, column 49)
_lhsOchunks =
({-# LINE 842 "GenerateCode.ag" #-}
[]
{-# LINE 1820 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 127, column 47)
_lhsOgathNts =
({-# LINE 127 "GenerateCode.ag" #-}
Set.empty
{-# LINE 1825 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 670, column 86)
_lhsOsemDomUnfoldGath =
({-# LINE 670 "GenerateCode.ag" #-}
Map.empty
{-# LINE 1830 "GenerateCode.hs" #-})
in ( _lhsOchunks,_lhsOgathNts,_lhsOsemDomUnfoldGath))) )
-- CProduction -------------------------------------------------
{-
visit 0:
inherited attributes:
allNts : Set NontermIdent
allPragmas : PragmaMap
aroundMap : Map ConstructorIdent (Set Identifier)
contextMap : ContextMap
inh : Attributes
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramMap : ParamMap
prefix : String
syn : Attributes
unfoldSemDom : NontermIdent -> Int -> [String] -> Code.Type
with_sig : Bool
synthesized attributes:
cataAlt : Decl
comments : [String]
dataAlt : DataAlt
decls : Decls
semNames : [String]
alternatives:
alternative CProduction:
child con : {ConstructorIdent}
child visits : CVisits
child children : {[(Identifier,Type,Maybe (Maybe Type))]}
child terminals : {[Identifier]}
visit 0:
local paramInstMap : _
local aroundMap : _
local firstOrderChildren : _
local params : _
-}
-- cata
sem_CProduction :: CProduction ->
T_CProduction
sem_CProduction (CProduction _con _visits _children _terminals ) =
(sem_CProduction_CProduction _con (sem_CVisits _visits ) _children _terminals )
-- semantic domain
newtype T_CProduction = T_CProduction ((Set NontermIdent) ->
PragmaMap ->
(Map ConstructorIdent (Set Identifier)) ->
ContextMap ->
Attributes ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
ParamMap ->
String ->
Attributes ->
(NontermIdent -> Int -> [String] -> Code.Type) ->
Bool ->
( Decl,([String]),DataAlt,Decls,([String])))
data Inh_CProduction = Inh_CProduction {allNts_Inh_CProduction :: !((Set NontermIdent)),allPragmas_Inh_CProduction :: !(PragmaMap),aroundMap_Inh_CProduction :: !((Map ConstructorIdent (Set Identifier))),contextMap_Inh_CProduction :: !(ContextMap),inh_Inh_CProduction :: !(Attributes),nt_Inh_CProduction :: !(NontermIdent),o_case_Inh_CProduction :: !(Bool),o_cata_Inh_CProduction :: !(Bool),o_costcentre_Inh_CProduction :: !(Bool),o_data_Inh_CProduction :: !((Maybe Bool)),o_linePragmas_Inh_CProduction :: !(Bool),o_monadic_Inh_CProduction :: !(Bool),o_newtypes_Inh_CProduction :: !(Bool),o_pretty_Inh_CProduction :: !(Bool),o_rename_Inh_CProduction :: !(Bool),o_sem_Inh_CProduction :: !(Bool),o_sig_Inh_CProduction :: !(Bool),o_splitsems_Inh_CProduction :: !(Bool),o_strictwrap_Inh_CProduction :: !(Bool),o_traces_Inh_CProduction :: !(Bool),o_unbox_Inh_CProduction :: !(Bool),paramMap_Inh_CProduction :: !(ParamMap),prefix_Inh_CProduction :: !(String),syn_Inh_CProduction :: !(Attributes),unfoldSemDom_Inh_CProduction :: !((NontermIdent -> Int -> [String] -> Code.Type)),with_sig_Inh_CProduction :: !(Bool)}
data Syn_CProduction = Syn_CProduction {cataAlt_Syn_CProduction :: !(Decl),comments_Syn_CProduction :: !(([String])),dataAlt_Syn_CProduction :: !(DataAlt),decls_Syn_CProduction :: !(Decls),semNames_Syn_CProduction :: !(([String]))}
wrap_CProduction :: T_CProduction ->
Inh_CProduction ->
Syn_CProduction
wrap_CProduction (T_CProduction sem ) (Inh_CProduction _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIcontextMap _lhsIinh _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIunfoldSemDom _lhsIwith_sig ) =
(let ( _lhsOcataAlt,_lhsOcomments,_lhsOdataAlt,_lhsOdecls,_lhsOsemNames) =
(sem _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIcontextMap _lhsIinh _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIunfoldSemDom _lhsIwith_sig )
in (Syn_CProduction _lhsOcataAlt _lhsOcomments _lhsOdataAlt _lhsOdecls _lhsOsemNames ))
sem_CProduction_CProduction :: ConstructorIdent ->
T_CVisits ->
([(Identifier,Type,Maybe (Maybe Type))]) ->
([Identifier]) ->
T_CProduction
sem_CProduction_CProduction con_ (T_CVisits visits_ ) children_ terminals_ =
(T_CProduction (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIcontextMap
_lhsIinh
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIunfoldSemDom
_lhsIwith_sig ->
(let _visitsOcon :: ConstructorIdent
_visitsOterminals :: ([Identifier])
_visitsOnr :: Int
_visitsOchildren :: ([(Identifier,Type, Maybe (Maybe Type))])
_visitsOinstVisitNrs :: (Map Identifier Int)
_lhsOcomments :: ([String])
_lhsOdataAlt :: DataAlt
_lhsOcataAlt :: Decl
_lhsOdecls :: Decls
_lhsOsemNames :: ([String])
_visitsOallNts :: (Set NontermIdent)
_visitsOallPragmas :: PragmaMap
_visitsOaroundMap :: (Set Identifier)
_visitsOcontextMap :: ContextMap
_visitsOinh :: Attributes
_visitsOnt :: NontermIdent
_visitsOo_case :: Bool
_visitsOo_cata :: Bool
_visitsOo_costcentre :: Bool
_visitsOo_data :: (Maybe Bool)
_visitsOo_linePragmas :: Bool
_visitsOo_monadic :: Bool
_visitsOo_newtypes :: Bool
_visitsOo_pretty :: Bool
_visitsOo_rename :: Bool
_visitsOo_sem :: Bool
_visitsOo_sig :: Bool
_visitsOo_splitsems :: Bool
_visitsOo_strictwrap :: Bool
_visitsOo_traces :: Bool
_visitsOo_unbox :: Bool
_visitsOparamInstMap :: (Map Identifier (NontermIdent, [String]))
_visitsOparamMap :: ParamMap
_visitsOprefix :: String
_visitsOsyn :: Attributes
_visitsOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_visitsOwith_sig :: Bool
_visitsIcomments :: ([String])
_visitsIdecls :: Decls
_visitsIgatherInstVisitNrs :: (Map Identifier Int)
_visitsIintra :: Exprs
_visitsIintraVars :: (Set String)
_visitsIisNil :: Bool
_visitsIsemNames :: ([String])
-- "GenerateCode.ag"(line 86, column 19)
_visitsOcon =
({-# LINE 86 "GenerateCode.ag" #-}
con_
{-# LINE 2002 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 87, column 20)
_visitsOterminals =
({-# LINE 87 "GenerateCode.ag" #-}
terminals_
{-# LINE 2007 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 99, column 7)
_paramInstMap =
({-# LINE 99 "GenerateCode.ag" #-}
Map.fromList [(nm, (extractNonterminal tp, tps)) | (nm,tp,_) <- children_, let tps = map cleanupArg $ nontermArgs tp, not (null tps) ]
{-# LINE 2012 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 242, column 18)
_visitsOnr =
({-# LINE 242 "GenerateCode.ag" #-}
0
{-# LINE 2017 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 383, column 18)
_visitsOchildren =
({-# LINE 383 "GenerateCode.ag" #-}
children_
{-# LINE 2022 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 521, column 7)
_visitsOinstVisitNrs =
({-# LINE 521 "GenerateCode.ag" #-}
_visitsIgatherInstVisitNrs
{-# LINE 2027 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 541, column 34)
_aroundMap =
({-# LINE 541 "GenerateCode.ag" #-}
Map.findWithDefault Set.empty con_ _lhsIaroundMap
{-# LINE 2032 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 804, column 18)
_firstOrderChildren =
({-# LINE 804 "GenerateCode.ag" #-}
[ (nm,fromJust mb,virt) | (nm,tp,virt) <- children_, let mb = isFirstOrder virt tp, isJust mb ]
{-# LINE 2037 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 805, column 18)
_lhsOcomments =
({-# LINE 805 "GenerateCode.ag" #-}
("alternative " ++ getName con_ ++ ":")
: map ind ( map (\(x,y,_) -> makeLocalComment 14 "child" x (Just y)) _firstOrderChildren
++ _visitsIcomments
)
{-# LINE 2045 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 940, column 17)
_params =
({-# LINE 940 "GenerateCode.ag" #-}
map getName $ Map.findWithDefault [] _lhsInt _lhsIparamMap
{-# LINE 2050 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 941, column 17)
_lhsOdataAlt =
({-# LINE 941 "GenerateCode.ag" #-}
DataAlt (conname _lhsIo_rename _lhsInt con_) (map (\(_,t,_) -> typeToCodeType (Just _lhsInt) _params t) _firstOrderChildren )
{-# LINE 2055 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 1040, column 17)
_lhsOcataAlt =
({-# LINE 1040 "GenerateCode.ag" #-}
let lhs = Fun (cataname _lhsIprefix _lhsInt) [lhs_pat]
lhs_pat = App (conname _lhsIo_rename _lhsInt con_)
(map (\(n,_,_) -> SimpleExpr $ locname $ n) _firstOrderChildren )
rhs = App (semname _lhsIprefix _lhsInt con_)
(map argument _firstOrderChildren )
argument (nm,NT tp _,_) = let tp' = maybe tp id (deforestedNt tp)
in App (cataname _lhsIprefix tp')
[SimpleExpr (locname nm)]
argument (nm, _,_) = SimpleExpr (locname nm)
in Decl lhs rhs Set.empty Set.empty
{-# LINE 2069 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 843, column 44)
_lhsOdecls =
({-# LINE 843 "GenerateCode.ag" #-}
_visitsIdecls
{-# LINE 2074 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 1056, column 61)
_lhsOsemNames =
({-# LINE 1056 "GenerateCode.ag" #-}
_visitsIsemNames
{-# LINE 2079 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 2084 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOallPragmas =
({-# LINE 67 "GenerateCode.ag" #-}
_lhsIallPragmas
{-# LINE 2089 "GenerateCode.hs" #-})
-- copy rule (from local)
_visitsOaroundMap =
({-# LINE 537 "GenerateCode.ag" #-}
_aroundMap
{-# LINE 2094 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOcontextMap =
({-# LINE 109 "GenerateCode.ag" #-}
_lhsIcontextMap
{-# LINE 2099 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 2104 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 2109 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 2114 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 2119 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 2124 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 2129 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 2134 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 2139 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 2144 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 2149 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 2154 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 2159 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 2164 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 2169 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 2174 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 2179 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 2184 "GenerateCode.hs" #-})
-- copy rule (from local)
_visitsOparamInstMap =
({-# LINE 95 "GenerateCode.ag" #-}
_paramInstMap
{-# LINE 2189 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 2194 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 2199 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 2204 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 2209 "GenerateCode.hs" #-})
-- copy rule (down)
_visitsOwith_sig =
({-# LINE 776 "GenerateCode.ag" #-}
_lhsIwith_sig
{-# LINE 2214 "GenerateCode.hs" #-})
( _visitsIcomments,_visitsIdecls,_visitsIgatherInstVisitNrs,_visitsIintra,_visitsIintraVars,_visitsIisNil,_visitsIsemNames) =
(visits_ _visitsOallNts _visitsOallPragmas _visitsOaroundMap _visitsOchildren _visitsOcon _visitsOcontextMap _visitsOinh _visitsOinstVisitNrs _visitsOnr _visitsOnt _visitsOo_case _visitsOo_cata _visitsOo_costcentre _visitsOo_data _visitsOo_linePragmas _visitsOo_monadic _visitsOo_newtypes _visitsOo_pretty _visitsOo_rename _visitsOo_sem _visitsOo_sig _visitsOo_splitsems _visitsOo_strictwrap _visitsOo_traces _visitsOo_unbox _visitsOparamInstMap _visitsOparamMap _visitsOprefix _visitsOsyn _visitsOterminals _visitsOunfoldSemDom _visitsOwith_sig )
in ( _lhsOcataAlt,_lhsOcomments,_lhsOdataAlt,_lhsOdecls,_lhsOsemNames))) )
-- CProductions ------------------------------------------------
{-
visit 0:
inherited attributes:
allNts : Set NontermIdent
allPragmas : PragmaMap
aroundMap : Map ConstructorIdent (Set Identifier)
contextMap : ContextMap
inh : Attributes
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramMap : ParamMap
prefix : String
syn : Attributes
unfoldSemDom : NontermIdent -> Int -> [String] -> Code.Type
with_sig : Bool
synthesized attributes:
cataAlts : Decls
comments : [String]
dataAlts : DataAlts
decls : Decls
semNames : [String]
alternatives:
alternative Cons:
child hd : CProduction
child tl : CProductions
alternative Nil:
-}
-- cata
sem_CProductions :: CProductions ->
T_CProductions
sem_CProductions list =
(Prelude.foldr sem_CProductions_Cons sem_CProductions_Nil (Prelude.map sem_CProduction list) )
-- semantic domain
newtype T_CProductions = T_CProductions ((Set NontermIdent) ->
PragmaMap ->
(Map ConstructorIdent (Set Identifier)) ->
ContextMap ->
Attributes ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
ParamMap ->
String ->
Attributes ->
(NontermIdent -> Int -> [String] -> Code.Type) ->
Bool ->
( Decls,([String]),DataAlts,Decls,([String])))
data Inh_CProductions = Inh_CProductions {allNts_Inh_CProductions :: !((Set NontermIdent)),allPragmas_Inh_CProductions :: !(PragmaMap),aroundMap_Inh_CProductions :: !((Map ConstructorIdent (Set Identifier))),contextMap_Inh_CProductions :: !(ContextMap),inh_Inh_CProductions :: !(Attributes),nt_Inh_CProductions :: !(NontermIdent),o_case_Inh_CProductions :: !(Bool),o_cata_Inh_CProductions :: !(Bool),o_costcentre_Inh_CProductions :: !(Bool),o_data_Inh_CProductions :: !((Maybe Bool)),o_linePragmas_Inh_CProductions :: !(Bool),o_monadic_Inh_CProductions :: !(Bool),o_newtypes_Inh_CProductions :: !(Bool),o_pretty_Inh_CProductions :: !(Bool),o_rename_Inh_CProductions :: !(Bool),o_sem_Inh_CProductions :: !(Bool),o_sig_Inh_CProductions :: !(Bool),o_splitsems_Inh_CProductions :: !(Bool),o_strictwrap_Inh_CProductions :: !(Bool),o_traces_Inh_CProductions :: !(Bool),o_unbox_Inh_CProductions :: !(Bool),paramMap_Inh_CProductions :: !(ParamMap),prefix_Inh_CProductions :: !(String),syn_Inh_CProductions :: !(Attributes),unfoldSemDom_Inh_CProductions :: !((NontermIdent -> Int -> [String] -> Code.Type)),with_sig_Inh_CProductions :: !(Bool)}
data Syn_CProductions = Syn_CProductions {cataAlts_Syn_CProductions :: !(Decls),comments_Syn_CProductions :: !(([String])),dataAlts_Syn_CProductions :: !(DataAlts),decls_Syn_CProductions :: !(Decls),semNames_Syn_CProductions :: !(([String]))}
wrap_CProductions :: T_CProductions ->
Inh_CProductions ->
Syn_CProductions
wrap_CProductions (T_CProductions sem ) (Inh_CProductions _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIcontextMap _lhsIinh _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIunfoldSemDom _lhsIwith_sig ) =
(let ( _lhsOcataAlts,_lhsOcomments,_lhsOdataAlts,_lhsOdecls,_lhsOsemNames) =
(sem _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIcontextMap _lhsIinh _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIunfoldSemDom _lhsIwith_sig )
in (Syn_CProductions _lhsOcataAlts _lhsOcomments _lhsOdataAlts _lhsOdecls _lhsOsemNames ))
sem_CProductions_Cons :: T_CProduction ->
T_CProductions ->
T_CProductions
sem_CProductions_Cons (T_CProduction hd_ ) (T_CProductions tl_ ) =
(T_CProductions (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIcontextMap
_lhsIinh
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIunfoldSemDom
_lhsIwith_sig ->
(let _lhsOdataAlts :: DataAlts
_lhsOcataAlts :: Decls
_lhsOcomments :: ([String])
_lhsOdecls :: Decls
_lhsOsemNames :: ([String])
_hdOallNts :: (Set NontermIdent)
_hdOallPragmas :: PragmaMap
_hdOaroundMap :: (Map ConstructorIdent (Set Identifier))
_hdOcontextMap :: ContextMap
_hdOinh :: Attributes
_hdOnt :: NontermIdent
_hdOo_case :: Bool
_hdOo_cata :: Bool
_hdOo_costcentre :: Bool
_hdOo_data :: (Maybe Bool)
_hdOo_linePragmas :: Bool
_hdOo_monadic :: Bool
_hdOo_newtypes :: Bool
_hdOo_pretty :: Bool
_hdOo_rename :: Bool
_hdOo_sem :: Bool
_hdOo_sig :: Bool
_hdOo_splitsems :: Bool
_hdOo_strictwrap :: Bool
_hdOo_traces :: Bool
_hdOo_unbox :: Bool
_hdOparamMap :: ParamMap
_hdOprefix :: String
_hdOsyn :: Attributes
_hdOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_hdOwith_sig :: Bool
_tlOallNts :: (Set NontermIdent)
_tlOallPragmas :: PragmaMap
_tlOaroundMap :: (Map ConstructorIdent (Set Identifier))
_tlOcontextMap :: ContextMap
_tlOinh :: Attributes
_tlOnt :: NontermIdent
_tlOo_case :: Bool
_tlOo_cata :: Bool
_tlOo_costcentre :: Bool
_tlOo_data :: (Maybe Bool)
_tlOo_linePragmas :: Bool
_tlOo_monadic :: Bool
_tlOo_newtypes :: Bool
_tlOo_pretty :: Bool
_tlOo_rename :: Bool
_tlOo_sem :: Bool
_tlOo_sig :: Bool
_tlOo_splitsems :: Bool
_tlOo_strictwrap :: Bool
_tlOo_traces :: Bool
_tlOo_unbox :: Bool
_tlOparamMap :: ParamMap
_tlOprefix :: String
_tlOsyn :: Attributes
_tlOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_tlOwith_sig :: Bool
_hdIcataAlt :: Decl
_hdIcomments :: ([String])
_hdIdataAlt :: DataAlt
_hdIdecls :: Decls
_hdIsemNames :: ([String])
_tlIcataAlts :: Decls
_tlIcomments :: ([String])
_tlIdataAlts :: DataAlts
_tlIdecls :: Decls
_tlIsemNames :: ([String])
-- "GenerateCode.ag"(line 936, column 17)
_lhsOdataAlts =
({-# LINE 936 "GenerateCode.ag" #-}
_hdIdataAlt : _tlIdataAlts
{-# LINE 2403 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 1036, column 10)
_lhsOcataAlts =
({-# LINE 1036 "GenerateCode.ag" #-}
_hdIcataAlt : _tlIcataAlts
{-# LINE 2408 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
_hdIcomments ++ _tlIcomments
{-# LINE 2413 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 843, column 44)
_lhsOdecls =
({-# LINE 843 "GenerateCode.ag" #-}
_hdIdecls ++ _tlIdecls
{-# LINE 2418 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 1056, column 61)
_lhsOsemNames =
({-# LINE 1056 "GenerateCode.ag" #-}
_hdIsemNames ++ _tlIsemNames
{-# LINE 2423 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 2428 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOallPragmas =
({-# LINE 67 "GenerateCode.ag" #-}
_lhsIallPragmas
{-# LINE 2433 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOaroundMap =
({-# LINE 535 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 2438 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOcontextMap =
({-# LINE 109 "GenerateCode.ag" #-}
_lhsIcontextMap
{-# LINE 2443 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 2448 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 2453 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 2458 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 2463 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 2468 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 2473 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 2478 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 2483 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 2488 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 2493 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 2498 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 2503 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 2508 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 2513 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 2518 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 2523 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 2528 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 2533 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 2538 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 2543 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 2548 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOwith_sig =
({-# LINE 776 "GenerateCode.ag" #-}
_lhsIwith_sig
{-# LINE 2553 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 2558 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOallPragmas =
({-# LINE 67 "GenerateCode.ag" #-}
_lhsIallPragmas
{-# LINE 2563 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOaroundMap =
({-# LINE 535 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 2568 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOcontextMap =
({-# LINE 109 "GenerateCode.ag" #-}
_lhsIcontextMap
{-# LINE 2573 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 2578 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 2583 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 2588 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 2593 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 2598 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 2603 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 2608 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 2613 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 2618 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 2623 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 2628 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 2633 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 2638 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 2643 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 2648 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 2653 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 2658 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 2663 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 2668 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 2673 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 2678 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOwith_sig =
({-# LINE 776 "GenerateCode.ag" #-}
_lhsIwith_sig
{-# LINE 2683 "GenerateCode.hs" #-})
( _hdIcataAlt,_hdIcomments,_hdIdataAlt,_hdIdecls,_hdIsemNames) =
(hd_ _hdOallNts _hdOallPragmas _hdOaroundMap _hdOcontextMap _hdOinh _hdOnt _hdOo_case _hdOo_cata _hdOo_costcentre _hdOo_data _hdOo_linePragmas _hdOo_monadic _hdOo_newtypes _hdOo_pretty _hdOo_rename _hdOo_sem _hdOo_sig _hdOo_splitsems _hdOo_strictwrap _hdOo_traces _hdOo_unbox _hdOparamMap _hdOprefix _hdOsyn _hdOunfoldSemDom _hdOwith_sig )
( _tlIcataAlts,_tlIcomments,_tlIdataAlts,_tlIdecls,_tlIsemNames) =
(tl_ _tlOallNts _tlOallPragmas _tlOaroundMap _tlOcontextMap _tlOinh _tlOnt _tlOo_case _tlOo_cata _tlOo_costcentre _tlOo_data _tlOo_linePragmas _tlOo_monadic _tlOo_newtypes _tlOo_pretty _tlOo_rename _tlOo_sem _tlOo_sig _tlOo_splitsems _tlOo_strictwrap _tlOo_traces _tlOo_unbox _tlOparamMap _tlOprefix _tlOsyn _tlOunfoldSemDom _tlOwith_sig )
in ( _lhsOcataAlts,_lhsOcomments,_lhsOdataAlts,_lhsOdecls,_lhsOsemNames))) )
sem_CProductions_Nil :: T_CProductions
sem_CProductions_Nil =
(T_CProductions (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIcontextMap
_lhsIinh
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIunfoldSemDom
_lhsIwith_sig ->
(let _lhsOdataAlts :: DataAlts
_lhsOcataAlts :: Decls
_lhsOcomments :: ([String])
_lhsOdecls :: Decls
_lhsOsemNames :: ([String])
-- "GenerateCode.ag"(line 937, column 17)
_lhsOdataAlts =
({-# LINE 937 "GenerateCode.ag" #-}
[]
{-# LINE 2726 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 1037, column 10)
_lhsOcataAlts =
({-# LINE 1037 "GenerateCode.ag" #-}
[]
{-# LINE 2731 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
[]
{-# LINE 2736 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 843, column 44)
_lhsOdecls =
({-# LINE 843 "GenerateCode.ag" #-}
[]
{-# LINE 2741 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 1056, column 61)
_lhsOsemNames =
({-# LINE 1056 "GenerateCode.ag" #-}
[]
{-# LINE 2746 "GenerateCode.hs" #-})
in ( _lhsOcataAlts,_lhsOcomments,_lhsOdataAlts,_lhsOdecls,_lhsOsemNames))) )
-- CRule -------------------------------------------------------
{-
visit 0:
inherited attributes:
allNts : Set NontermIdent
aroundMap : Set Identifier
children : [(Identifier,Type,Maybe (Maybe Type))]
con : ConstructorIdent
inh : Attributes
instVisitNrs : Map Identifier Int
nr : Int
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramInstMap : Map Identifier (NontermIdent, [String])
paramMap : ParamMap
prefix : String
syn : Attributes
terminals : [Identifier]
unfoldSemDom : NontermIdent -> Int -> [String] -> Code.Type
what : String
chained attribute:
declsAbove : [Decl]
synthesized attributes:
allTpsFound : Bool
bldBlocksFun : DeclBlocks -> DeclBlocks
comments : [String]
decls : Decls
definedInsts : [Identifier]
exprs : Exprs
tSigs : [Decl]
tps : [Type]
usedVars : Set String
alternatives:
alternative CChildVisit:
child name : {Identifier}
child nt : {NontermIdent}
child nr : {Int}
child inh : {Attributes}
child syn : {Attributes}
child isLast : {Bool}
visit 0:
local costCentreDescr : _
local addCostCentre : _
local decls : _
local isSuperfluousHigherOrderIntra : _
local names : _
local mkTp : _
local definedTps : _
local nextTp : _
local orgParams : _
local instParams : _
local replParamMap : _
local replace : _
local evalTp : _
alternative CRule:
child name : {Identifier}
child isIn : {Bool}
child hasCode : {Bool}
child nt : {NontermIdent}
child con : {ConstructorIdent}
child field : {Identifier}
child childnt : {Maybe NontermIdent}
child tp : {Maybe Type}
child pattern : Pattern
child rhs : {[String]}
child defines : {Map Int (Identifier,Identifier,Maybe Type)}
child owrt : {Bool}
child origin : {String}
child uses : {Set (Identifier, Identifier)}
child explicit : {Bool}
child mbNamed : {Maybe Identifier}
visit 0:
local instTypes : _
local originComment : _
local instDecls : _
local patDescr : _
local traceDescr : _
local addTrace : _
local costCentreDescr : _
local addCostCentre : _
local addLinePragma : _
local decls : _
local definedInsts : _
local rulename : _
local mkTp : _
local orgParams : _
local evalTp : _
local _tup3 : {([Type],Bool)}
-}
-- cata
sem_CRule :: CRule ->
T_CRule
sem_CRule (CChildVisit _name _nt _nr _inh _syn _isLast ) =
(sem_CRule_CChildVisit _name _nt _nr _inh _syn _isLast )
sem_CRule (CRule _name _isIn _hasCode _nt _con _field _childnt _tp _pattern _rhs _defines _owrt _origin _uses _explicit _mbNamed ) =
(sem_CRule_CRule _name _isIn _hasCode _nt _con _field _childnt _tp (sem_Pattern _pattern ) _rhs _defines _owrt _origin _uses _explicit _mbNamed )
-- semantic domain
newtype T_CRule = T_CRule ((Set NontermIdent) ->
(Set Identifier) ->
([(Identifier,Type,Maybe (Maybe Type))]) ->
ConstructorIdent ->
([Decl]) ->
Attributes ->
(Map Identifier Int) ->
Int ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
(Map Identifier (NontermIdent, [String])) ->
ParamMap ->
String ->
Attributes ->
([Identifier]) ->
(NontermIdent -> Int -> [String] -> Code.Type) ->
String ->
( Bool,(DeclBlocks -> DeclBlocks),([String]),Decls,([Decl]),([Identifier]),Exprs,([Decl]),([Type]),(Set String)))
data Inh_CRule = Inh_CRule {allNts_Inh_CRule :: !((Set NontermIdent)),aroundMap_Inh_CRule :: !((Set Identifier)),children_Inh_CRule :: !(([(Identifier,Type,Maybe (Maybe Type))])),con_Inh_CRule :: !(ConstructorIdent),declsAbove_Inh_CRule :: !(([Decl])),inh_Inh_CRule :: !(Attributes),instVisitNrs_Inh_CRule :: !((Map Identifier Int)),nr_Inh_CRule :: !(Int),nt_Inh_CRule :: !(NontermIdent),o_case_Inh_CRule :: !(Bool),o_cata_Inh_CRule :: !(Bool),o_costcentre_Inh_CRule :: !(Bool),o_data_Inh_CRule :: !((Maybe Bool)),o_linePragmas_Inh_CRule :: !(Bool),o_monadic_Inh_CRule :: !(Bool),o_newtypes_Inh_CRule :: !(Bool),o_pretty_Inh_CRule :: !(Bool),o_rename_Inh_CRule :: !(Bool),o_sem_Inh_CRule :: !(Bool),o_sig_Inh_CRule :: !(Bool),o_splitsems_Inh_CRule :: !(Bool),o_strictwrap_Inh_CRule :: !(Bool),o_traces_Inh_CRule :: !(Bool),o_unbox_Inh_CRule :: !(Bool),paramInstMap_Inh_CRule :: !((Map Identifier (NontermIdent, [String]))),paramMap_Inh_CRule :: !(ParamMap),prefix_Inh_CRule :: !(String),syn_Inh_CRule :: !(Attributes),terminals_Inh_CRule :: !(([Identifier])),unfoldSemDom_Inh_CRule :: !((NontermIdent -> Int -> [String] -> Code.Type)),what_Inh_CRule :: !(String)}
data Syn_CRule = Syn_CRule {allTpsFound_Syn_CRule :: !(Bool),bldBlocksFun_Syn_CRule :: !((DeclBlocks -> DeclBlocks)),comments_Syn_CRule :: !(([String])),decls_Syn_CRule :: !(Decls),declsAbove_Syn_CRule :: !(([Decl])),definedInsts_Syn_CRule :: !(([Identifier])),exprs_Syn_CRule :: !(Exprs),tSigs_Syn_CRule :: !(([Decl])),tps_Syn_CRule :: !(([Type])),usedVars_Syn_CRule :: !((Set String))}
wrap_CRule :: T_CRule ->
Inh_CRule ->
Syn_CRule
wrap_CRule (T_CRule sem ) (Inh_CRule _lhsIallNts _lhsIaroundMap _lhsIchildren _lhsIcon _lhsIdeclsAbove _lhsIinh _lhsIinstVisitNrs _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamInstMap _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIterminals _lhsIunfoldSemDom _lhsIwhat ) =
(let ( _lhsOallTpsFound,_lhsObldBlocksFun,_lhsOcomments,_lhsOdecls,_lhsOdeclsAbove,_lhsOdefinedInsts,_lhsOexprs,_lhsOtSigs,_lhsOtps,_lhsOusedVars) =
(sem _lhsIallNts _lhsIaroundMap _lhsIchildren _lhsIcon _lhsIdeclsAbove _lhsIinh _lhsIinstVisitNrs _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamInstMap _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIterminals _lhsIunfoldSemDom _lhsIwhat )
in (Syn_CRule _lhsOallTpsFound _lhsObldBlocksFun _lhsOcomments _lhsOdecls _lhsOdeclsAbove _lhsOdefinedInsts _lhsOexprs _lhsOtSigs _lhsOtps _lhsOusedVars ))
sem_CRule_CChildVisit :: Identifier ->
NontermIdent ->
Int ->
Attributes ->
Attributes ->
Bool ->
T_CRule
sem_CRule_CChildVisit name_ nt_ nr_ inh_ syn_ isLast_ =
(T_CRule (\ _lhsIallNts
_lhsIaroundMap
_lhsIchildren
_lhsIcon
_lhsIdeclsAbove
_lhsIinh
_lhsIinstVisitNrs
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamInstMap
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIterminals
_lhsIunfoldSemDom
_lhsIwhat ->
(let _lhsOexprs :: Exprs
_lhsOusedVars :: (Set String)
_lhsOtSigs :: ([Decl])
_lhsOtps :: ([Type])
_lhsOdeclsAbove :: ([Decl])
_lhsObldBlocksFun :: (DeclBlocks -> DeclBlocks)
_lhsOallTpsFound :: Bool
_lhsOcomments :: ([String])
_lhsOdecls :: Decls
_lhsOdefinedInsts :: ([Identifier])
-- "GenerateCode.ag"(line 187, column 18)
_costCentreDescr =
({-# LINE 187 "GenerateCode.ag" #-}
show _lhsInt ++ ":" ++ show _lhsIcon ++ ":" ++ show name_ ++ ":" ++ show nt_ ++ ":" ++ show nr_
{-# LINE 2953 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 188, column 18)
_addCostCentre =
({-# LINE 188 "GenerateCode.ag" #-}
\v -> if _lhsIo_costcentre
then PragmaExpr True False ("SCC \"" ++ _costCentreDescr ++ "\"") v
else v
{-# LINE 2960 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 191, column 18)
_decls =
({-# LINE 191 "GenerateCode.ag" #-}
let lhsVars = map (attrname True name_) (Map.keys syn_)
++ if isLast_ then [] else [unwrap ++ funname name_ (nr_+1)]
rhsVars = map (attrname False name_) (Map.keys inh_)
unwrap = if _lhsIo_newtypes then typeName nt_ (nr_ + 1) ++ " " else ""
tuple = mkTupleLhs _lhsIo_unbox (null $ Map.keys inh_) lhsVars
rhs = _addCostCentre $ App fun (map SimpleExpr rhsVars)
isVirtual _ [] = False
isVirtual nm ((n,t,mb) : r)
| nm == n = isJust mb
| otherwise = isVirtual nm r
baseNm = if nr_ == 0 && isVirtual name_ _lhsIchildren
then Ident (getName name_ ++ "_inst") (getPos name_)
else name_
fun | nr_ == 0 && Set.member name_ _lhsIaroundMap
= locname name_ ++ "_around " ++ funname baseNm 0
| otherwise = funname baseNm nr_
in [mkDecl _lhsIo_monadic tuple rhs (Set.fromList lhsVars) (Set.fromList (funname baseNm nr_ : rhsVars))]
{-# LINE 2981 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 289, column 7)
_isSuperfluousHigherOrderIntra =
({-# LINE 289 "GenerateCode.ag" #-}
_lhsInr <= Map.findWithDefault (-1) name_ _lhsIinstVisitNrs
{-# LINE 2986 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 303, column 8)
_names =
({-# LINE 303 "GenerateCode.ag" #-}
if _isSuperfluousHigherOrderIntra
then []
else [funname name_ (nr_+1)]
{-# LINE 2993 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 307, column 8)
_lhsOexprs =
({-# LINE 307 "GenerateCode.ag" #-}
let wrap = if _lhsIo_newtypes then \x -> App (typeName nt_ (nr_ + 1)) [x] else id
addType expr | null _instParams = expr
| otherwise = TypedExpr expr (_lhsIunfoldSemDom nt_ (nr_+1) _instParams )
in map (wrap . addType . SimpleExpr) _names
{-# LINE 3001 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 319, column 7)
_lhsOusedVars =
({-# LINE 319 "GenerateCode.ag" #-}
Set.fromList _names
{-# LINE 3006 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 358, column 19)
_mkTp =
({-# LINE 358 "GenerateCode.ag" #-}
_evalTp . typeToCodeType (Just nt_) _orgParams
{-# LINE 3011 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 359, column 19)
_definedTps =
({-# LINE 359 "GenerateCode.ag" #-}
[ TSig (attrname True name_ a) (_mkTp tp) | (a,tp) <- Map.toList syn_ ]
{-# LINE 3016 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 360, column 19)
_nextTp =
({-# LINE 360 "GenerateCode.ag" #-}
typeName nt_ (nr_+1)
{-# LINE 3021 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 361, column 19)
_lhsOtSigs =
({-# LINE 361 "GenerateCode.ag" #-}
(if isLast_ then id else (TSig (funname name_ (nr_+1)) (TypeApp (SimpleType _nextTp) (map SimpleType _instParams )) :)) _definedTps
{-# LINE 3026 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 363, column 19)
_orgParams =
({-# LINE 363 "GenerateCode.ag" #-}
map getName $ Map.findWithDefault [] nt_ _lhsIparamMap
{-# LINE 3031 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 364, column 19)
_instParams =
({-# LINE 364 "GenerateCode.ag" #-}
snd $ Map.findWithDefault (nt_,[]) name_ _lhsIparamInstMap
{-# LINE 3036 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 365, column 19)
_replParamMap =
({-# LINE 365 "GenerateCode.ag" #-}
Map.fromList (zip _orgParams _instParams )
{-# LINE 3041 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 366, column 19)
_replace =
({-# LINE 366 "GenerateCode.ag" #-}
\k -> Map.findWithDefault k k _replParamMap
{-# LINE 3046 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 367, column 19)
_evalTp =
({-# LINE 367 "GenerateCode.ag" #-}
if null _orgParams then id else evalType _replace
{-# LINE 3051 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 390, column 19)
_lhsOtps =
({-# LINE 390 "GenerateCode.ag" #-}
if _isSuperfluousHigherOrderIntra
then []
else [NT (ntOfVisit nt_ (nr_+1)) _instParams ]
{-# LINE 3058 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 559, column 7)
_lhsOdeclsAbove =
({-# LINE 559 "GenerateCode.ag" #-}
[]
{-# LINE 3063 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 572, column 7)
_lhsObldBlocksFun =
({-# LINE 572 "GenerateCode.ag" #-}
DeclBlock _lhsIdeclsAbove (head _decls )
{-# LINE 3068 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 387, column 39)
_lhsOallTpsFound =
({-# LINE 387 "GenerateCode.ag" #-}
True
{-# LINE 3073 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
[]
{-# LINE 3078 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 139, column 34)
_lhsOdecls =
({-# LINE 139 "GenerateCode.ag" #-}
_decls
{-# LINE 3083 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
[]
{-# LINE 3088 "GenerateCode.hs" #-})
in ( _lhsOallTpsFound,_lhsObldBlocksFun,_lhsOcomments,_lhsOdecls,_lhsOdeclsAbove,_lhsOdefinedInsts,_lhsOexprs,_lhsOtSigs,_lhsOtps,_lhsOusedVars))) )
sem_CRule_CRule :: Identifier ->
Bool ->
Bool ->
NontermIdent ->
ConstructorIdent ->
Identifier ->
(Maybe NontermIdent) ->
(Maybe Type) ->
T_Pattern ->
([String]) ->
(Map Int (Identifier,Identifier,Maybe Type)) ->
Bool ->
String ->
(Set (Identifier, Identifier)) ->
Bool ->
(Maybe Identifier) ->
T_CRule
sem_CRule_CRule name_ isIn_ hasCode_ nt_ con_ field_ childnt_ tp_ (T_Pattern pattern_ ) rhs_ defines_ owrt_ origin_ uses_ explicit_ mbNamed_ =
(T_CRule (\ _lhsIallNts
_lhsIaroundMap
_lhsIchildren
_lhsIcon
_lhsIdeclsAbove
_lhsIinh
_lhsIinstVisitNrs
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamInstMap
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIterminals
_lhsIunfoldSemDom
_lhsIwhat ->
(let _lhsOexprs :: Exprs
_lhsOusedVars :: (Set String)
_lhsOtSigs :: ([Decl])
__tup3 :: (([Type],Bool))
_lhsOtps :: ([Type])
_lhsOallTpsFound :: Bool
_lhsOdeclsAbove :: ([Decl])
_lhsObldBlocksFun :: (DeclBlocks -> DeclBlocks)
_lhsOcomments :: ([String])
_lhsOdecls :: Decls
_lhsOdefinedInsts :: ([Identifier])
_patternIcopy :: Pattern
_patternIdefinedInsts :: ([Identifier])
_patternIpatternAttributes :: ([(Identifier, Identifier)])
-- "GenerateCode.ag"(line 141, column 12)
_instTypes =
({-# LINE 141 "GenerateCode.ag" #-}
[ (n, (t, mb)) | (n, NT t _, mb) <- _lhsIchildren ]
{-# LINE 3157 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 142, column 12)
_originComment =
({-# LINE 142 "GenerateCode.ag" #-}
if _lhsIo_pretty
then (Comment origin_:)
else id
{-# LINE 3164 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 145, column 12)
_instDecls =
({-# LINE 145 "GenerateCode.ag" #-}
[ mkDecl _lhsIo_monadic (Pattern3 (Alias _INST' inst (Underscore (getPos inst)) []))
( let (nm,mb) = fromJust $ inst `lookup` _instTypes
in unwrapSem _lhsIo_newtypes (maybe nm id (deforestedNt nm))
$ case mb of
Just (Just tp') -> App instLocFieldName [SimpleExpr $ fieldname inst]
_ ->
case nm `Set.member` _lhsIallNts of
True -> App (cataname _lhsIprefix nm)
[SimpleExpr instLocFieldName]
False -> SimpleExpr instLocFieldName
)
(Set.singleton instSemFieldName)
(Set.singleton instLocFieldName)
| inst <- _definedInsts
, let instLocFieldName = attrname True _INST inst
instSemFieldName = attrname False _INST' inst
]
{-# LINE 3185 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 162, column 12)
_patDescr =
({-# LINE 162 "GenerateCode.ag" #-}
if isIn_
then "_"
else concat $ intersperse "," (map (\(f,a) -> show f ++ "." ++ show a) _patternIpatternAttributes)
{-# LINE 3192 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 165, column 12)
_traceDescr =
({-# LINE 165 "GenerateCode.ag" #-}
(maybe "" (\nm -> show nm ++ ":") mbNamed_) ++ show nt_ ++ " :: " ++ show con_ ++ " :: " ++ _patDescr
{-# LINE 3197 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 167, column 12)
_addTrace =
({-# LINE 167 "GenerateCode.ag" #-}
\v -> if _lhsIo_traces
then Trace _traceDescr v
else v
{-# LINE 3204 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 170, column 12)
_costCentreDescr =
({-# LINE 170 "GenerateCode.ag" #-}
show nt_ ++ ":" ++ show con_ ++ ":" ++ _patDescr
{-# LINE 3209 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 171, column 12)
_addCostCentre =
({-# LINE 171 "GenerateCode.ag" #-}
\v -> if _lhsIo_costcentre
then PragmaExpr True False ("SCC \"" ++ _costCentreDescr ++ "\"") v
else v
{-# LINE 3216 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 174, column 12)
_addLinePragma =
({-# LINE 174 "GenerateCode.ag" #-}
\v -> let p = getPos name_
hasPos = line p > 0 && column p >= 0 && not (null (file p))
in if _lhsIo_linePragmas && hasPos
then PragmaExpr True True ("LINE " ++ show (line p) ++ " " ++ show (file p))
$ LineExpr
$ v
else v
{-# LINE 3227 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 181, column 12)
_decls =
({-# LINE 181 "GenerateCode.ag" #-}
if hasCode_
then _originComment ( mkDecl (_lhsIo_monadic && explicit_) (Pattern3 _patternIcopy) (_addTrace $ _addCostCentre $ _addLinePragma $ (TextExpr rhs_))
(Set.fromList [attrname False fld nm | (fld,nm,_) <- Map.elems defines_])
(Set.fromList [attrname True fld nm | (fld,nm) <- Set.toList uses_])
: _instDecls )
else _instDecls
{-# LINE 3237 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 228, column 12)
_definedInsts =
({-# LINE 228 "GenerateCode.ag" #-}
if isIn_ then [] else _patternIdefinedInsts
{-# LINE 3242 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 298, column 12)
_rulename =
({-# LINE 298 "GenerateCode.ag" #-}
if field_ == _LOC && name_ `elem` _lhsIterminals
then funname name_ 0
else attrname isIn_ field_ name_
{-# LINE 3249 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 301, column 12)
_lhsOexprs =
({-# LINE 301 "GenerateCode.ag" #-}
[SimpleExpr _rulename ]
{-# LINE 3254 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 317, column 7)
_lhsOusedVars =
({-# LINE 317 "GenerateCode.ag" #-}
Set.singleton _rulename
{-# LINE 3259 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 327, column 19)
_mkTp =
({-# LINE 327 "GenerateCode.ag" #-}
typeToCodeType (Just _lhsInt) _orgParams
{-# LINE 3264 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 328, column 19)
_lhsOtSigs =
({-# LINE 328 "GenerateCode.ag" #-}
[ TSig (attrname False field attr) tp'
| (field,attr,tp) <- Map.elems defines_, isJust tp
, let tp1 = _evalTp field $ _mkTp (fromJust tp)
tp' = case findOrigType attr _lhsIchildren of
Just tp' -> let tp'' = case tp' of
NT n params -> NT (Ident ("T_" ++ show n) (getPos n)) params
_ -> tp'
tp2 = _evalTp field $ _mkTp tp''
in Arr tp2 tp1
Nothing -> tp1
findOrigType nm [] = Nothing
findOrigType nm ((n,_,mb) : r)
| nm == n = case mb of
Just (Just orig) -> Just orig
_ -> Nothing
| otherwise = findOrigType nm r
]
{-# LINE 3285 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 346, column 19)
_orgParams =
({-# LINE 346 "GenerateCode.ag" #-}
map getName $ Map.findWithDefault [] _lhsInt _lhsIparamMap
{-# LINE 3290 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 347, column 19)
_evalTp =
({-# LINE 347 "GenerateCode.ag" #-}
\field tp -> let orgFldParams = map getName $ Map.findWithDefault [] childNt _lhsIparamMap
(childNt,instParams) = Map.findWithDefault (_lhsInt,[]) field _lhsIparamInstMap
replMap = Map.fromList (zip orgFldParams instParams)
replace k = Map.findWithDefault ('@':k) k replMap
in if null instParams
then if null _orgParams
then tp
else idEvalType tp
else evalType replace tp
{-# LINE 3303 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 389, column 23)
__tup3 =
({-# LINE 389 "GenerateCode.ag" #-}
maybe ([],False) (\tp -> ([substSelf (fromJust childnt_) tp],True)) tp_
{-# LINE 3308 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 389, column 23)
(_lhsOtps,_) =
({-# LINE 389 "GenerateCode.ag" #-}
__tup3
{-# LINE 3313 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 389, column 23)
(_,_lhsOallTpsFound) =
({-# LINE 389 "GenerateCode.ag" #-}
__tup3
{-# LINE 3318 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 557, column 7)
_lhsOdeclsAbove =
({-# LINE 557 "GenerateCode.ag" #-}
_lhsIdeclsAbove ++ _decls
{-# LINE 3323 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 570, column 7)
_lhsObldBlocksFun =
({-# LINE 570 "GenerateCode.ag" #-}
id
{-# LINE 3328 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 827, column 18)
_lhsOcomments =
({-# LINE 827 "GenerateCode.ag" #-}
[ makeLocalComment 11 _lhsIwhat name tp | (field,name,tp) <- Map.elems defines_, field == _LOC ]
++ [ makeLocalComment 11 "inst " name tp | (field,name,tp) <- Map.elems defines_, field == _INST ]
{-# LINE 3334 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 139, column 34)
_lhsOdecls =
({-# LINE 139 "GenerateCode.ag" #-}
_decls
{-# LINE 3339 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
_definedInsts
{-# LINE 3344 "GenerateCode.hs" #-})
( _patternIcopy,_patternIdefinedInsts,_patternIpatternAttributes) =
(pattern_ )
in ( _lhsOallTpsFound,_lhsObldBlocksFun,_lhsOcomments,_lhsOdecls,_lhsOdeclsAbove,_lhsOdefinedInsts,_lhsOexprs,_lhsOtSigs,_lhsOtps,_lhsOusedVars))) )
-- CSegment ----------------------------------------------------
{-
visit 0:
inherited attributes:
inh : Attributes
isLast : Bool
nr : Int
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramMap : ParamMap
prefix : String
syn : Attributes
synthesized attributes:
comments : [String]
semDom : [Decl]
semDomUnfoldGath : Map (NontermIdent, Int) ([String], Code.Type)
wrapDecls : Decls
alternatives:
alternative CSegment:
child inh : {Attributes}
child syn : {Attributes}
visit 0:
local tp : _
local inhTps : _
local synTps : _
local continuation : _
local params : _
-}
-- cata
sem_CSegment :: CSegment ->
T_CSegment
sem_CSegment (CSegment _inh _syn ) =
(sem_CSegment_CSegment _inh _syn )
-- semantic domain
newtype T_CSegment = T_CSegment (Attributes ->
Bool ->
Int ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
ParamMap ->
String ->
Attributes ->
( ([String]),([Decl]),(Map (NontermIdent, Int) ([String], Code.Type)),Decls))
data Inh_CSegment = Inh_CSegment {inh_Inh_CSegment :: !(Attributes),isLast_Inh_CSegment :: !(Bool),nr_Inh_CSegment :: !(Int),nt_Inh_CSegment :: !(NontermIdent),o_case_Inh_CSegment :: !(Bool),o_cata_Inh_CSegment :: !(Bool),o_costcentre_Inh_CSegment :: !(Bool),o_data_Inh_CSegment :: !((Maybe Bool)),o_linePragmas_Inh_CSegment :: !(Bool),o_monadic_Inh_CSegment :: !(Bool),o_newtypes_Inh_CSegment :: !(Bool),o_pretty_Inh_CSegment :: !(Bool),o_rename_Inh_CSegment :: !(Bool),o_sem_Inh_CSegment :: !(Bool),o_sig_Inh_CSegment :: !(Bool),o_splitsems_Inh_CSegment :: !(Bool),o_strictwrap_Inh_CSegment :: !(Bool),o_traces_Inh_CSegment :: !(Bool),o_unbox_Inh_CSegment :: !(Bool),paramMap_Inh_CSegment :: !(ParamMap),prefix_Inh_CSegment :: !(String),syn_Inh_CSegment :: !(Attributes)}
data Syn_CSegment = Syn_CSegment {comments_Syn_CSegment :: !(([String])),semDom_Syn_CSegment :: !(([Decl])),semDomUnfoldGath_Syn_CSegment :: !((Map (NontermIdent, Int) ([String], Code.Type))),wrapDecls_Syn_CSegment :: !(Decls)}
wrap_CSegment :: T_CSegment ->
Inh_CSegment ->
Syn_CSegment
wrap_CSegment (T_CSegment sem ) (Inh_CSegment _lhsIinh _lhsIisLast _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn ) =
(let ( _lhsOcomments,_lhsOsemDom,_lhsOsemDomUnfoldGath,_lhsOwrapDecls) =
(sem _lhsIinh _lhsIisLast _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn )
in (Syn_CSegment _lhsOcomments _lhsOsemDom _lhsOsemDomUnfoldGath _lhsOwrapDecls ))
sem_CSegment_CSegment :: Attributes ->
Attributes ->
T_CSegment
sem_CSegment_CSegment inh_ syn_ =
(T_CSegment (\ _lhsIinh
_lhsIisLast
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsIsyn ->
(let _lhsOsemDom :: ([Decl])
_lhsOsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_lhsOwrapDecls :: Decls
_lhsOcomments :: ([String])
-- "GenerateCode.ag"(line 656, column 15)
_tp =
({-# LINE 656 "GenerateCode.ag" #-}
foldr Arr _synTps _inhTps
{-# LINE 3462 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 657, column 15)
_inhTps =
({-# LINE 657 "GenerateCode.ag" #-}
[typeToCodeType (Just _lhsInt) _params tp | tp <- Map.elems inh_]
{-# LINE 3467 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 658, column 15)
_synTps =
({-# LINE 658 "GenerateCode.ag" #-}
mkTupleType _lhsIo_unbox (null _inhTps ) ([typeToCodeType (Just _lhsInt) _params tp | tp <- Map.elems syn_] ++ _continuation )
{-# LINE 3472 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 659, column 15)
_continuation =
({-# LINE 659 "GenerateCode.ag" #-}
if _lhsIisLast
then []
else [TypeApp (SimpleType (typeName _lhsInt (_lhsInr + 1))) (map (SimpleType . ('@':)) _params )]
{-# LINE 3479 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 662, column 15)
_params =
({-# LINE 662 "GenerateCode.ag" #-}
map getName $ Map.findWithDefault [] _lhsInt _lhsIparamMap
{-# LINE 3484 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 663, column 15)
_lhsOsemDom =
({-# LINE 663 "GenerateCode.ag" #-}
let name = typeName _lhsInt _lhsInr
evalTp | null _params = id
| otherwise = idEvalType
in if _lhsIo_newtypes
then [ Code.NewType name _params name (evalTp _tp ) ]
else [ Code.Type name _params (evalTp _tp ) ]
{-# LINE 3494 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 674, column 7)
_lhsOsemDomUnfoldGath =
({-# LINE 674 "GenerateCode.ag" #-}
Map.singleton (_lhsInt, _lhsInr) (_params , _tp )
{-# LINE 3499 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 758, column 15)
_lhsOwrapDecls =
({-# LINE 758 "GenerateCode.ag" #-}
let lhsVars = map (lhsname False) (Map.keys syn_)
++ if _lhsIisLast then [] else [unwrap ++ sem (_lhsInr+1)]
rhsVars = map (lhsname True) (Map.keys inh_)
rhs = map SimpleExpr rhsVars
unwrap = if _lhsIo_newtypes then typeName _lhsInt (_lhsInr + 1) ++ " " else ""
var = "sem"
sem 0 = var
sem n = var ++ "_" ++ show n
in [ Decl (mkTupleLhs _lhsIo_unbox (null $ Map.keys inh_) lhsVars) (App (sem _lhsInr) rhs) (Set.fromList lhsVars) (Set.fromList rhsVars) ]
{-# LINE 3512 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 798, column 18)
_lhsOcomments =
({-# LINE 798 "GenerateCode.ag" #-}
let body = map ind (showsSegment (CSegment inh_ syn_))
in if null body
then []
else ("visit " ++ show _lhsInr ++ ":") : body
{-# LINE 3520 "GenerateCode.hs" #-})
in ( _lhsOcomments,_lhsOsemDom,_lhsOsemDomUnfoldGath,_lhsOwrapDecls))) )
-- CSegments ---------------------------------------------------
{-
visit 0:
inherited attributes:
inh : Attributes
nr : Int
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramMap : ParamMap
prefix : String
syn : Attributes
synthesized attributes:
comments : [String]
isNil : Bool
semDom : [Decl]
semDomUnfoldGath : Map (NontermIdent, Int) ([String], Code.Type)
wrapDecls : Decls
alternatives:
alternative Cons:
child hd : CSegment
child tl : CSegments
alternative Nil:
-}
-- cata
sem_CSegments :: CSegments ->
T_CSegments
sem_CSegments list =
(Prelude.foldr sem_CSegments_Cons sem_CSegments_Nil (Prelude.map sem_CSegment list) )
-- semantic domain
newtype T_CSegments = T_CSegments (Attributes ->
Int ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
ParamMap ->
String ->
Attributes ->
( ([String]),Bool,([Decl]),(Map (NontermIdent, Int) ([String], Code.Type)),Decls))
data Inh_CSegments = Inh_CSegments {inh_Inh_CSegments :: !(Attributes),nr_Inh_CSegments :: !(Int),nt_Inh_CSegments :: !(NontermIdent),o_case_Inh_CSegments :: !(Bool),o_cata_Inh_CSegments :: !(Bool),o_costcentre_Inh_CSegments :: !(Bool),o_data_Inh_CSegments :: !((Maybe Bool)),o_linePragmas_Inh_CSegments :: !(Bool),o_monadic_Inh_CSegments :: !(Bool),o_newtypes_Inh_CSegments :: !(Bool),o_pretty_Inh_CSegments :: !(Bool),o_rename_Inh_CSegments :: !(Bool),o_sem_Inh_CSegments :: !(Bool),o_sig_Inh_CSegments :: !(Bool),o_splitsems_Inh_CSegments :: !(Bool),o_strictwrap_Inh_CSegments :: !(Bool),o_traces_Inh_CSegments :: !(Bool),o_unbox_Inh_CSegments :: !(Bool),paramMap_Inh_CSegments :: !(ParamMap),prefix_Inh_CSegments :: !(String),syn_Inh_CSegments :: !(Attributes)}
data Syn_CSegments = Syn_CSegments {comments_Syn_CSegments :: !(([String])),isNil_Syn_CSegments :: !(Bool),semDom_Syn_CSegments :: !(([Decl])),semDomUnfoldGath_Syn_CSegments :: !((Map (NontermIdent, Int) ([String], Code.Type))),wrapDecls_Syn_CSegments :: !(Decls)}
wrap_CSegments :: T_CSegments ->
Inh_CSegments ->
Syn_CSegments
wrap_CSegments (T_CSegments sem ) (Inh_CSegments _lhsIinh _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn ) =
(let ( _lhsOcomments,_lhsOisNil,_lhsOsemDom,_lhsOsemDomUnfoldGath,_lhsOwrapDecls) =
(sem _lhsIinh _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamMap _lhsIprefix _lhsIsyn )
in (Syn_CSegments _lhsOcomments _lhsOisNil _lhsOsemDom _lhsOsemDomUnfoldGath _lhsOwrapDecls ))
sem_CSegments_Cons :: T_CSegment ->
T_CSegments ->
T_CSegments
sem_CSegments_Cons (T_CSegment hd_ ) (T_CSegments tl_ ) =
(T_CSegments (\ _lhsIinh
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsIsyn ->
(let _tlOnr :: Int
_lhsOisNil :: Bool
_hdOisLast :: Bool
_lhsOcomments :: ([String])
_lhsOsemDom :: ([Decl])
_lhsOsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_lhsOwrapDecls :: Decls
_hdOinh :: Attributes
_hdOnr :: Int
_hdOnt :: NontermIdent
_hdOo_case :: Bool
_hdOo_cata :: Bool
_hdOo_costcentre :: Bool
_hdOo_data :: (Maybe Bool)
_hdOo_linePragmas :: Bool
_hdOo_monadic :: Bool
_hdOo_newtypes :: Bool
_hdOo_pretty :: Bool
_hdOo_rename :: Bool
_hdOo_sem :: Bool
_hdOo_sig :: Bool
_hdOo_splitsems :: Bool
_hdOo_strictwrap :: Bool
_hdOo_traces :: Bool
_hdOo_unbox :: Bool
_hdOparamMap :: ParamMap
_hdOprefix :: String
_hdOsyn :: Attributes
_tlOinh :: Attributes
_tlOnt :: NontermIdent
_tlOo_case :: Bool
_tlOo_cata :: Bool
_tlOo_costcentre :: Bool
_tlOo_data :: (Maybe Bool)
_tlOo_linePragmas :: Bool
_tlOo_monadic :: Bool
_tlOo_newtypes :: Bool
_tlOo_pretty :: Bool
_tlOo_rename :: Bool
_tlOo_sem :: Bool
_tlOo_sig :: Bool
_tlOo_splitsems :: Bool
_tlOo_strictwrap :: Bool
_tlOo_traces :: Bool
_tlOo_unbox :: Bool
_tlOparamMap :: ParamMap
_tlOprefix :: String
_tlOsyn :: Attributes
_hdIcomments :: ([String])
_hdIsemDom :: ([Decl])
_hdIsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_hdIwrapDecls :: Decls
_tlIcomments :: ([String])
_tlIisNil :: Bool
_tlIsemDom :: ([Decl])
_tlIsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_tlIwrapDecls :: Decls
-- "GenerateCode.ag"(line 248, column 11)
_tlOnr =
({-# LINE 248 "GenerateCode.ag" #-}
_lhsInr + 1
{-# LINE 3682 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 261, column 12)
_lhsOisNil =
({-# LINE 261 "GenerateCode.ag" #-}
False
{-# LINE 3687 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 262, column 12)
_hdOisLast =
({-# LINE 262 "GenerateCode.ag" #-}
_tlIisNil
{-# LINE 3692 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
_hdIcomments ++ _tlIcomments
{-# LINE 3697 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 651, column 50)
_lhsOsemDom =
({-# LINE 651 "GenerateCode.ag" #-}
_hdIsemDom ++ _tlIsemDom
{-# LINE 3702 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 670, column 86)
_lhsOsemDomUnfoldGath =
({-# LINE 670 "GenerateCode.ag" #-}
_hdIsemDomUnfoldGath `Map.union` _tlIsemDomUnfoldGath
{-# LINE 3707 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 756, column 52)
_lhsOwrapDecls =
({-# LINE 756 "GenerateCode.ag" #-}
_hdIwrapDecls ++ _tlIwrapDecls
{-# LINE 3712 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 3717 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOnr =
({-# LINE 240 "GenerateCode.ag" #-}
_lhsInr
{-# LINE 3722 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 3727 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 3732 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 3737 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 3742 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 3747 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 3752 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 3757 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 3762 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 3767 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 3772 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 3777 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 3782 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 3787 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 3792 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 3797 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 3802 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 3807 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 3812 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 3817 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 3822 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 3827 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 3832 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 3837 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 3842 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 3847 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 3852 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 3857 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 3862 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 3867 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 3872 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 3877 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 3882 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 3887 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 3892 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 3897 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 3902 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 3907 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 3912 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 3917 "GenerateCode.hs" #-})
( _hdIcomments,_hdIsemDom,_hdIsemDomUnfoldGath,_hdIwrapDecls) =
(hd_ _hdOinh _hdOisLast _hdOnr _hdOnt _hdOo_case _hdOo_cata _hdOo_costcentre _hdOo_data _hdOo_linePragmas _hdOo_monadic _hdOo_newtypes _hdOo_pretty _hdOo_rename _hdOo_sem _hdOo_sig _hdOo_splitsems _hdOo_strictwrap _hdOo_traces _hdOo_unbox _hdOparamMap _hdOprefix _hdOsyn )
( _tlIcomments,_tlIisNil,_tlIsemDom,_tlIsemDomUnfoldGath,_tlIwrapDecls) =
(tl_ _tlOinh _tlOnr _tlOnt _tlOo_case _tlOo_cata _tlOo_costcentre _tlOo_data _tlOo_linePragmas _tlOo_monadic _tlOo_newtypes _tlOo_pretty _tlOo_rename _tlOo_sem _tlOo_sig _tlOo_splitsems _tlOo_strictwrap _tlOo_traces _tlOo_unbox _tlOparamMap _tlOprefix _tlOsyn )
in ( _lhsOcomments,_lhsOisNil,_lhsOsemDom,_lhsOsemDomUnfoldGath,_lhsOwrapDecls))) )
sem_CSegments_Nil :: T_CSegments
sem_CSegments_Nil =
(T_CSegments (\ _lhsIinh
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamMap
_lhsIprefix
_lhsIsyn ->
(let _lhsOisNil :: Bool
_lhsOcomments :: ([String])
_lhsOsemDom :: ([Decl])
_lhsOsemDomUnfoldGath :: (Map (NontermIdent, Int) ([String], Code.Type))
_lhsOwrapDecls :: Decls
-- "GenerateCode.ag"(line 263, column 10)
_lhsOisNil =
({-# LINE 263 "GenerateCode.ag" #-}
True
{-# LINE 3955 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
[]
{-# LINE 3960 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 651, column 50)
_lhsOsemDom =
({-# LINE 651 "GenerateCode.ag" #-}
[]
{-# LINE 3965 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 670, column 86)
_lhsOsemDomUnfoldGath =
({-# LINE 670 "GenerateCode.ag" #-}
Map.empty
{-# LINE 3970 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 756, column 52)
_lhsOwrapDecls =
({-# LINE 756 "GenerateCode.ag" #-}
[]
{-# LINE 3975 "GenerateCode.hs" #-})
in ( _lhsOcomments,_lhsOisNil,_lhsOsemDom,_lhsOsemDomUnfoldGath,_lhsOwrapDecls))) )
-- CVisit ------------------------------------------------------
{-
visit 0:
inherited attributes:
allNts : Set NontermIdent
allPragmas : PragmaMap
aroundMap : Set Identifier
children : [(Identifier,Type, Maybe (Maybe Type))]
con : ConstructorIdent
contextMap : ContextMap
inh : Attributes
instVisitNrs : Map Identifier Int
isLast : Bool
nextIntra : Exprs
nextIntraVars : Set String
nr : Int
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramInstMap : Map Identifier (NontermIdent, [String])
paramMap : ParamMap
prefix : String
syn : Attributes
terminals : [Identifier]
unfoldSemDom : NontermIdent -> Int -> [String] -> Code.Type
with_sig : Bool
chained attribute:
decls : Decls
synthesized attributes:
comments : [String]
gatherInstVisitNrs : Map Identifier Int
intra : Exprs
intraVars : Set String
semNames : [String]
alternatives:
alternative CVisit:
child inh : {Attributes}
child syn : {Attributes}
child vss : Sequence
child intra : Sequence
child ordered : {Bool}
visit 0:
local _tup4 : _
local higherOrderChildren : _
local firstOrderChildren : _
local firstOrderOrig : _
local funcname : _
local nextVisitName : _
local nextVisitDecl : _
local decls : _
local lastExprVars : _
local _tup5 : _
local blockFunDecls : _
local blockFirstFunCall : _
local costCentreDescr : _
local addCostCentre : _
local params : _
local semFun : _
local tsig : _
local semType : _
local typeSigs : _
local o_do : _
local o_case : _
local declsType : _
local o_splitsems : _
-}
-- cata
sem_CVisit :: CVisit ->
T_CVisit
sem_CVisit (CVisit _inh _syn _vss _intra _ordered ) =
(sem_CVisit_CVisit _inh _syn (sem_Sequence _vss ) (sem_Sequence _intra ) _ordered )
-- semantic domain
newtype T_CVisit = T_CVisit ((Set NontermIdent) ->
PragmaMap ->
(Set Identifier) ->
([(Identifier,Type, Maybe (Maybe Type))]) ->
ConstructorIdent ->
ContextMap ->
Decls ->
Attributes ->
(Map Identifier Int) ->
Bool ->
Exprs ->
(Set String) ->
Int ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
(Map Identifier (NontermIdent, [String])) ->
ParamMap ->
String ->
Attributes ->
([Identifier]) ->
(NontermIdent -> Int -> [String] -> Code.Type) ->
Bool ->
( ([String]),Decls,(Map Identifier Int),Exprs,(Set String),([String])))
data Inh_CVisit = Inh_CVisit {allNts_Inh_CVisit :: !((Set NontermIdent)),allPragmas_Inh_CVisit :: !(PragmaMap),aroundMap_Inh_CVisit :: !((Set Identifier)),children_Inh_CVisit :: !(([(Identifier,Type, Maybe (Maybe Type))])),con_Inh_CVisit :: !(ConstructorIdent),contextMap_Inh_CVisit :: !(ContextMap),decls_Inh_CVisit :: !(Decls),inh_Inh_CVisit :: !(Attributes),instVisitNrs_Inh_CVisit :: !((Map Identifier Int)),isLast_Inh_CVisit :: !(Bool),nextIntra_Inh_CVisit :: !(Exprs),nextIntraVars_Inh_CVisit :: !((Set String)),nr_Inh_CVisit :: !(Int),nt_Inh_CVisit :: !(NontermIdent),o_case_Inh_CVisit :: !(Bool),o_cata_Inh_CVisit :: !(Bool),o_costcentre_Inh_CVisit :: !(Bool),o_data_Inh_CVisit :: !((Maybe Bool)),o_linePragmas_Inh_CVisit :: !(Bool),o_monadic_Inh_CVisit :: !(Bool),o_newtypes_Inh_CVisit :: !(Bool),o_pretty_Inh_CVisit :: !(Bool),o_rename_Inh_CVisit :: !(Bool),o_sem_Inh_CVisit :: !(Bool),o_sig_Inh_CVisit :: !(Bool),o_splitsems_Inh_CVisit :: !(Bool),o_strictwrap_Inh_CVisit :: !(Bool),o_traces_Inh_CVisit :: !(Bool),o_unbox_Inh_CVisit :: !(Bool),paramInstMap_Inh_CVisit :: !((Map Identifier (NontermIdent, [String]))),paramMap_Inh_CVisit :: !(ParamMap),prefix_Inh_CVisit :: !(String),syn_Inh_CVisit :: !(Attributes),terminals_Inh_CVisit :: !(([Identifier])),unfoldSemDom_Inh_CVisit :: !((NontermIdent -> Int -> [String] -> Code.Type)),with_sig_Inh_CVisit :: !(Bool)}
data Syn_CVisit = Syn_CVisit {comments_Syn_CVisit :: !(([String])),decls_Syn_CVisit :: !(Decls),gatherInstVisitNrs_Syn_CVisit :: !((Map Identifier Int)),intra_Syn_CVisit :: !(Exprs),intraVars_Syn_CVisit :: !((Set String)),semNames_Syn_CVisit :: !(([String]))}
wrap_CVisit :: T_CVisit ->
Inh_CVisit ->
Syn_CVisit
wrap_CVisit (T_CVisit sem ) (Inh_CVisit _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIchildren _lhsIcon _lhsIcontextMap _lhsIdecls _lhsIinh _lhsIinstVisitNrs _lhsIisLast _lhsInextIntra _lhsInextIntraVars _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamInstMap _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIterminals _lhsIunfoldSemDom _lhsIwith_sig ) =
(let ( _lhsOcomments,_lhsOdecls,_lhsOgatherInstVisitNrs,_lhsOintra,_lhsOintraVars,_lhsOsemNames) =
(sem _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIchildren _lhsIcon _lhsIcontextMap _lhsIdecls _lhsIinh _lhsIinstVisitNrs _lhsIisLast _lhsInextIntra _lhsInextIntraVars _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamInstMap _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIterminals _lhsIunfoldSemDom _lhsIwith_sig )
in (Syn_CVisit _lhsOcomments _lhsOdecls _lhsOgatherInstVisitNrs _lhsOintra _lhsOintraVars _lhsOsemNames ))
sem_CVisit_CVisit :: Attributes ->
Attributes ->
T_Sequence ->
T_Sequence ->
Bool ->
T_CVisit
sem_CVisit_CVisit inh_ syn_ (T_Sequence vss_ ) (T_Sequence intra_ ) ordered_ =
(T_CVisit (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIchildren
_lhsIcon
_lhsIcontextMap
_lhsIdecls
_lhsIinh
_lhsIinstVisitNrs
_lhsIisLast
_lhsInextIntra
_lhsInextIntraVars
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamInstMap
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIterminals
_lhsIunfoldSemDom
_lhsIwith_sig ->
(let _lhsOintra :: Exprs
_lhsOintraVars :: (Set String)
_vssOlastExpr :: Expr
_intraOlastExpr :: Expr
_lhsOdecls :: Decls
_lhsOgatherInstVisitNrs :: (Map Identifier Int)
_vssOdeclsAbove :: ([Decl])
_intraOdeclsAbove :: ([Decl])
_lhsOcomments :: ([String])
_vssOwhat :: String
_intraOwhat :: String
_lhsOsemNames :: ([String])
_vssOallNts :: (Set NontermIdent)
_vssOaroundMap :: (Set Identifier)
_vssOchildren :: ([(Identifier,Type,Maybe (Maybe Type))])
_vssOcon :: ConstructorIdent
_vssOinh :: Attributes
_vssOinstVisitNrs :: (Map Identifier Int)
_vssOnr :: Int
_vssOnt :: NontermIdent
_vssOo_case :: Bool
_vssOo_cata :: Bool
_vssOo_costcentre :: Bool
_vssOo_data :: (Maybe Bool)
_vssOo_linePragmas :: Bool
_vssOo_monadic :: Bool
_vssOo_newtypes :: Bool
_vssOo_pretty :: Bool
_vssOo_rename :: Bool
_vssOo_sem :: Bool
_vssOo_sig :: Bool
_vssOo_splitsems :: Bool
_vssOo_strictwrap :: Bool
_vssOo_traces :: Bool
_vssOo_unbox :: Bool
_vssOparamInstMap :: (Map Identifier (NontermIdent, [String]))
_vssOparamMap :: ParamMap
_vssOprefix :: String
_vssOsyn :: Attributes
_vssOterminals :: ([Identifier])
_vssOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_intraOallNts :: (Set NontermIdent)
_intraOaroundMap :: (Set Identifier)
_intraOchildren :: ([(Identifier,Type,Maybe (Maybe Type))])
_intraOcon :: ConstructorIdent
_intraOinh :: Attributes
_intraOinstVisitNrs :: (Map Identifier Int)
_intraOnr :: Int
_intraOnt :: NontermIdent
_intraOo_case :: Bool
_intraOo_cata :: Bool
_intraOo_costcentre :: Bool
_intraOo_data :: (Maybe Bool)
_intraOo_linePragmas :: Bool
_intraOo_monadic :: Bool
_intraOo_newtypes :: Bool
_intraOo_pretty :: Bool
_intraOo_rename :: Bool
_intraOo_sem :: Bool
_intraOo_sig :: Bool
_intraOo_splitsems :: Bool
_intraOo_strictwrap :: Bool
_intraOo_traces :: Bool
_intraOo_unbox :: Bool
_intraOparamInstMap :: (Map Identifier (NontermIdent, [String]))
_intraOparamMap :: ParamMap
_intraOprefix :: String
_intraOsyn :: Attributes
_intraOterminals :: ([Identifier])
_intraOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_vssIallTpsFound :: Bool
_vssIblockDecls :: DeclBlocks
_vssIcomments :: ([String])
_vssIdecls :: Decls
_vssIdeclsAbove :: ([Decl])
_vssIdefinedInsts :: ([Identifier])
_vssIexprs :: Exprs
_vssItSigs :: ([Decl])
_vssItps :: ([Type])
_vssIusedVars :: (Set String)
_intraIallTpsFound :: Bool
_intraIblockDecls :: DeclBlocks
_intraIcomments :: ([String])
_intraIdecls :: Decls
_intraIdeclsAbove :: ([Decl])
_intraIdefinedInsts :: ([Identifier])
_intraIexprs :: Exprs
_intraItSigs :: ([Decl])
_intraItps :: ([Type])
_intraIusedVars :: (Set String)
-- "GenerateCode.ag"(line 272, column 13)
_lhsOintra =
({-# LINE 272 "GenerateCode.ag" #-}
_intraIexprs
{-# LINE 4245 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 273, column 13)
_lhsOintraVars =
({-# LINE 273 "GenerateCode.ag" #-}
_intraIusedVars
{-# LINE 4250 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 412, column 13)
__tup4 =
({-# LINE 412 "GenerateCode.ag" #-}
partition (\(_,_,virt) -> isHigherOrder virt) _lhsIchildren
{-# LINE 4255 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 412, column 13)
(_higherOrderChildren,_) =
({-# LINE 412 "GenerateCode.ag" #-}
__tup4
{-# LINE 4260 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 412, column 13)
(_,_firstOrderChildren) =
({-# LINE 412 "GenerateCode.ag" #-}
__tup4
{-# LINE 4265 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 413, column 13)
_firstOrderOrig =
({-# LINE 413 "GenerateCode.ag" #-}
map pickOrigType _firstOrderChildren
{-# LINE 4270 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 414, column 13)
_funcname =
({-# LINE 414 "GenerateCode.ag" #-}
seqSemname _lhsIprefix _lhsInt _lhsIcon _lhsInr
{-# LINE 4275 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 415, column 13)
_nextVisitName =
({-# LINE 415 "GenerateCode.ag" #-}
if _lhsIisLast then [] else [visitname _lhsIprefix _lhsInt (_lhsInr+1)]
{-# LINE 4280 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 416, column 13)
_nextVisitDecl =
({-# LINE 416 "GenerateCode.ag" #-}
let lhs = TupleLhs _nextVisitName
rhs = Let _lhsIdecls (SimpleExpr fun)
fun = seqSemname _lhsIprefix _lhsInt _lhsIcon (_lhsInr+1)
in if _lhsIisLast
then []
else [Decl lhs rhs (Set.fromList _nextVisitName) _lhsInextIntraVars]
{-# LINE 4290 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 423, column 13)
_decls =
({-# LINE 423 "GenerateCode.ag" #-}
_typeSigs ++ _vssIdecls ++ _nextVisitDecl
{-# LINE 4295 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 424, column 13)
_vssOlastExpr =
({-# LINE 424 "GenerateCode.ag" #-}
mkTupleExpr _lhsIo_unbox (null $ Map.keys inh_) $ map (SimpleExpr . lhsname False) (Map.keys syn_) ++ map SimpleExpr _nextVisitName
{-# LINE 4300 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 425, column 13)
_intraOlastExpr =
({-# LINE 425 "GenerateCode.ag" #-}
error "lastExpr: not used here"
{-# LINE 4305 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 426, column 13)
_lastExprVars =
({-# LINE 426 "GenerateCode.ag" #-}
map (lhsname False) (Map.keys syn_) ++ _nextVisitName
{-# LINE 4310 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 427, column 13)
__tup5 =
({-# LINE 427 "GenerateCode.ag" #-}
mkPartitionedFunction _funcname _o_case _nextVisitDecl _lastExprVars _vssIblockDecls
{-# LINE 4315 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 427, column 13)
(_blockFunDecls,_) =
({-# LINE 427 "GenerateCode.ag" #-}
__tup5
{-# LINE 4320 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 427, column 13)
(_,_blockFirstFunCall) =
({-# LINE 427 "GenerateCode.ag" #-}
__tup5
{-# LINE 4325 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 429, column 13)
_costCentreDescr =
({-# LINE 429 "GenerateCode.ag" #-}
"b" ++ ":" ++ show _lhsInt ++ ":" ++ show _lhsIcon ++ ":" ++ show _lhsInr
{-# LINE 4330 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 430, column 13)
_addCostCentre =
({-# LINE 430 "GenerateCode.ag" #-}
\v -> if _lhsIo_costcentre
then PragmaExpr True False ("SCC \"" ++ _costCentreDescr ++ "\"") v
else v
{-# LINE 4337 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 434, column 13)
_params =
({-# LINE 434 "GenerateCode.ag" #-}
map getName $ Map.findWithDefault [] _lhsInt _lhsIparamMap
{-# LINE 4342 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 435, column 13)
_semFun =
({-# LINE 435 "GenerateCode.ag" #-}
let lhs = Fun _funcname lhs_args
lhs_args = if _lhsInr == 0 then map field _firstOrderOrig else []
field (name,NT tp tps,_) = let unwrap | _lhsIo_newtypes = \x -> App (sdtype tp) [x]
| otherwise = id
addType expr | null tps = expr
| otherwise = TypedExpr expr (_lhsIunfoldSemDom tp 0 tps)
in unwrap $ addType $ SimpleExpr $ funname name 0
field (name,tp,_) = let expr = SimpleExpr (funname name 0)
in if null _params
then expr
else TypedExpr expr (idEvalType $ typeToCodeType (Just _lhsInt) _params tp)
mbEvalTp | null _params = const Nothing
| otherwise = Just . idEvalType
rhs = wrap
. mkLambda [mkLambdaArg (lhsname True nm) (mbEvalTp $ typeToCodeType (Just _lhsInt) _params tp) | (nm,tp) <- Map.assocs inh_]
$ _addCostCentre
$ if ordered_ && _o_splitsems
then _blockFirstFunCall
else mkDecls _declsType _decls
. mkTupleExpr _lhsIo_unbox (null $ Map.keys inh_)
$ map (SimpleExpr . lhsname False) (Map.keys syn_) ++ map SimpleExpr _nextVisitName
wrap = if _lhsIo_newtypes
then \x -> App (typeName _lhsInt _lhsInr) [x]
else id
in Decl lhs rhs Set.empty Set.empty
{-# LINE 4371 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 465, column 13)
_tsig =
({-# LINE 465 "GenerateCode.ag" #-}
TSig _funcname _semType
{-# LINE 4376 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 466, column 13)
_semType =
({-# LINE 466 "GenerateCode.ag" #-}
let argType (NT tp tps) r | tp /= _SELF = typeAppStrs (sdtype tp) tps `Arr` r
| tp == _SELF = error "GenerateCode: found an intra-type with type SELF, which should have been prevented by CRule.tps"
argType (Haskell tp) r = SimpleType tp `Arr` r
evalTp | null _params = id
| otherwise = idEvalType
in appContext _lhsIcontextMap _lhsInt $ evalTp $
if _lhsInr == 0
then foldr argType (typeAppStrs (sdtype _lhsInt ) _params ) (map (\(_,t,_) -> t) _firstOrderOrig )
else foldr argType (typeAppStrs (typeName _lhsInt _lhsInr) _params ) []
{-# LINE 4389 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 477, column 13)
_lhsOdecls =
({-# LINE 477 "GenerateCode.ag" #-}
( if _lhsIwith_sig
then [_tsig, _semFun]
else [_semFun]
) ++
( if ordered_ && _o_splitsems
then _blockFunDecls
else []
)
{-# LINE 4401 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 485, column 13)
_typeSigs =
({-# LINE 485 "GenerateCode.ag" #-}
if _lhsIo_sig && not _o_case
then _vssItSigs
else []
{-# LINE 4408 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 488, column 13)
_o_do =
({-# LINE 488 "GenerateCode.ag" #-}
ordered_ && _lhsIo_monadic
{-# LINE 4413 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 489, column 13)
_o_case =
({-# LINE 489 "GenerateCode.ag" #-}
not _o_do && _lhsIo_case && ordered_ && not (hasPragma _lhsIallPragmas _lhsInt _lhsIcon _NOCASE)
{-# LINE 4418 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 490, column 13)
_declsType =
({-# LINE 490 "GenerateCode.ag" #-}
if _o_do
then DeclsDo
else if _o_case
then DeclsCase
else DeclsLet
{-# LINE 4427 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 495, column 13)
_o_splitsems =
({-# LINE 495 "GenerateCode.ag" #-}
ordered_ && _lhsIo_splitsems
{-# LINE 4432 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 525, column 7)
_lhsOgatherInstVisitNrs =
({-# LINE 525 "GenerateCode.ag" #-}
Map.fromList [(i,_lhsInr) | i <- _vssIdefinedInsts]
{-# LINE 4437 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 552, column 7)
_vssOdeclsAbove =
({-# LINE 552 "GenerateCode.ag" #-}
[]
{-# LINE 4442 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 553, column 7)
_intraOdeclsAbove =
({-# LINE 553 "GenerateCode.ag" #-}
error "declsAbove: not used here"
{-# LINE 4447 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 818, column 18)
_lhsOcomments =
({-# LINE 818 "GenerateCode.ag" #-}
let body = map ind (_vssIcomments ++ _intraIcomments)
in if null body
then []
else ("visit " ++ show _lhsInr ++ ":") : body
{-# LINE 4455 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 822, column 18)
_vssOwhat =
({-# LINE 822 "GenerateCode.ag" #-}
"local"
{-# LINE 4460 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 823, column 18)
_intraOwhat =
({-# LINE 823 "GenerateCode.ag" #-}
"intra"
{-# LINE 4465 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 1066, column 7)
_lhsOsemNames =
({-# LINE 1066 "GenerateCode.ag" #-}
[_funcname ]
{-# LINE 4470 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 4475 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOaroundMap =
({-# LINE 537 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 4480 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOchildren =
({-# LINE 221 "GenerateCode.ag" #-}
_lhsIchildren
{-# LINE 4485 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOcon =
({-# LINE 83 "GenerateCode.ag" #-}
_lhsIcon
{-# LINE 4490 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 4495 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOinstVisitNrs =
({-# LINE 517 "GenerateCode.ag" #-}
_lhsIinstVisitNrs
{-# LINE 4500 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOnr =
({-# LINE 240 "GenerateCode.ag" #-}
_lhsInr
{-# LINE 4505 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 4510 "GenerateCode.hs" #-})
-- copy rule (from local)
_vssOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_o_case
{-# LINE 4515 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 4520 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 4525 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 4530 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 4535 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 4540 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 4545 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 4550 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 4555 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 4560 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 4565 "GenerateCode.hs" #-})
-- copy rule (from local)
_vssOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_o_splitsems
{-# LINE 4570 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 4575 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 4580 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 4585 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOparamInstMap =
({-# LINE 95 "GenerateCode.ag" #-}
_lhsIparamInstMap
{-# LINE 4590 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 4595 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 4600 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 4605 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOterminals =
({-# LINE 84 "GenerateCode.ag" #-}
_lhsIterminals
{-# LINE 4610 "GenerateCode.hs" #-})
-- copy rule (down)
_vssOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 4615 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 4620 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOaroundMap =
({-# LINE 537 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 4625 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOchildren =
({-# LINE 221 "GenerateCode.ag" #-}
_lhsIchildren
{-# LINE 4630 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOcon =
({-# LINE 83 "GenerateCode.ag" #-}
_lhsIcon
{-# LINE 4635 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 4640 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOinstVisitNrs =
({-# LINE 517 "GenerateCode.ag" #-}
_lhsIinstVisitNrs
{-# LINE 4645 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOnr =
({-# LINE 240 "GenerateCode.ag" #-}
_lhsInr
{-# LINE 4650 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 4655 "GenerateCode.hs" #-})
-- copy rule (from local)
_intraOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_o_case
{-# LINE 4660 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 4665 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 4670 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 4675 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 4680 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 4685 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 4690 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 4695 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 4700 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 4705 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 4710 "GenerateCode.hs" #-})
-- copy rule (from local)
_intraOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_o_splitsems
{-# LINE 4715 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 4720 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 4725 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 4730 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOparamInstMap =
({-# LINE 95 "GenerateCode.ag" #-}
_lhsIparamInstMap
{-# LINE 4735 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 4740 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 4745 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 4750 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOterminals =
({-# LINE 84 "GenerateCode.ag" #-}
_lhsIterminals
{-# LINE 4755 "GenerateCode.hs" #-})
-- copy rule (down)
_intraOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 4760 "GenerateCode.hs" #-})
( _vssIallTpsFound,_vssIblockDecls,_vssIcomments,_vssIdecls,_vssIdeclsAbove,_vssIdefinedInsts,_vssIexprs,_vssItSigs,_vssItps,_vssIusedVars) =
(vss_ _vssOallNts _vssOaroundMap _vssOchildren _vssOcon _vssOdeclsAbove _vssOinh _vssOinstVisitNrs _vssOlastExpr _vssOnr _vssOnt _vssOo_case _vssOo_cata _vssOo_costcentre _vssOo_data _vssOo_linePragmas _vssOo_monadic _vssOo_newtypes _vssOo_pretty _vssOo_rename _vssOo_sem _vssOo_sig _vssOo_splitsems _vssOo_strictwrap _vssOo_traces _vssOo_unbox _vssOparamInstMap _vssOparamMap _vssOprefix _vssOsyn _vssOterminals _vssOunfoldSemDom _vssOwhat )
( _intraIallTpsFound,_intraIblockDecls,_intraIcomments,_intraIdecls,_intraIdeclsAbove,_intraIdefinedInsts,_intraIexprs,_intraItSigs,_intraItps,_intraIusedVars) =
(intra_ _intraOallNts _intraOaroundMap _intraOchildren _intraOcon _intraOdeclsAbove _intraOinh _intraOinstVisitNrs _intraOlastExpr _intraOnr _intraOnt _intraOo_case _intraOo_cata _intraOo_costcentre _intraOo_data _intraOo_linePragmas _intraOo_monadic _intraOo_newtypes _intraOo_pretty _intraOo_rename _intraOo_sem _intraOo_sig _intraOo_splitsems _intraOo_strictwrap _intraOo_traces _intraOo_unbox _intraOparamInstMap _intraOparamMap _intraOprefix _intraOsyn _intraOterminals _intraOunfoldSemDom _intraOwhat )
in ( _lhsOcomments,_lhsOdecls,_lhsOgatherInstVisitNrs,_lhsOintra,_lhsOintraVars,_lhsOsemNames))) )
-- CVisits -----------------------------------------------------
{-
visit 0:
inherited attributes:
allNts : Set NontermIdent
allPragmas : PragmaMap
aroundMap : Set Identifier
children : [(Identifier,Type, Maybe (Maybe Type))]
con : ConstructorIdent
contextMap : ContextMap
inh : Attributes
instVisitNrs : Map Identifier Int
nr : Int
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramInstMap : Map Identifier (NontermIdent, [String])
paramMap : ParamMap
prefix : String
syn : Attributes
terminals : [Identifier]
unfoldSemDom : NontermIdent -> Int -> [String] -> Code.Type
with_sig : Bool
synthesized attributes:
comments : [String]
decls : Decls
gatherInstVisitNrs : Map Identifier Int
intra : Exprs
intraVars : Set String
isNil : Bool
semNames : [String]
alternatives:
alternative Cons:
child hd : CVisit
child tl : CVisits
alternative Nil:
-}
-- cata
sem_CVisits :: CVisits ->
T_CVisits
sem_CVisits list =
(Prelude.foldr sem_CVisits_Cons sem_CVisits_Nil (Prelude.map sem_CVisit list) )
-- semantic domain
newtype T_CVisits = T_CVisits ((Set NontermIdent) ->
PragmaMap ->
(Set Identifier) ->
([(Identifier,Type, Maybe (Maybe Type))]) ->
ConstructorIdent ->
ContextMap ->
Attributes ->
(Map Identifier Int) ->
Int ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
(Map Identifier (NontermIdent, [String])) ->
ParamMap ->
String ->
Attributes ->
([Identifier]) ->
(NontermIdent -> Int -> [String] -> Code.Type) ->
Bool ->
( ([String]),Decls,(Map Identifier Int),Exprs,(Set String),Bool,([String])))
data Inh_CVisits = Inh_CVisits {allNts_Inh_CVisits :: !((Set NontermIdent)),allPragmas_Inh_CVisits :: !(PragmaMap),aroundMap_Inh_CVisits :: !((Set Identifier)),children_Inh_CVisits :: !(([(Identifier,Type, Maybe (Maybe Type))])),con_Inh_CVisits :: !(ConstructorIdent),contextMap_Inh_CVisits :: !(ContextMap),inh_Inh_CVisits :: !(Attributes),instVisitNrs_Inh_CVisits :: !((Map Identifier Int)),nr_Inh_CVisits :: !(Int),nt_Inh_CVisits :: !(NontermIdent),o_case_Inh_CVisits :: !(Bool),o_cata_Inh_CVisits :: !(Bool),o_costcentre_Inh_CVisits :: !(Bool),o_data_Inh_CVisits :: !((Maybe Bool)),o_linePragmas_Inh_CVisits :: !(Bool),o_monadic_Inh_CVisits :: !(Bool),o_newtypes_Inh_CVisits :: !(Bool),o_pretty_Inh_CVisits :: !(Bool),o_rename_Inh_CVisits :: !(Bool),o_sem_Inh_CVisits :: !(Bool),o_sig_Inh_CVisits :: !(Bool),o_splitsems_Inh_CVisits :: !(Bool),o_strictwrap_Inh_CVisits :: !(Bool),o_traces_Inh_CVisits :: !(Bool),o_unbox_Inh_CVisits :: !(Bool),paramInstMap_Inh_CVisits :: !((Map Identifier (NontermIdent, [String]))),paramMap_Inh_CVisits :: !(ParamMap),prefix_Inh_CVisits :: !(String),syn_Inh_CVisits :: !(Attributes),terminals_Inh_CVisits :: !(([Identifier])),unfoldSemDom_Inh_CVisits :: !((NontermIdent -> Int -> [String] -> Code.Type)),with_sig_Inh_CVisits :: !(Bool)}
data Syn_CVisits = Syn_CVisits {comments_Syn_CVisits :: !(([String])),decls_Syn_CVisits :: !(Decls),gatherInstVisitNrs_Syn_CVisits :: !((Map Identifier Int)),intra_Syn_CVisits :: !(Exprs),intraVars_Syn_CVisits :: !((Set String)),isNil_Syn_CVisits :: !(Bool),semNames_Syn_CVisits :: !(([String]))}
wrap_CVisits :: T_CVisits ->
Inh_CVisits ->
Syn_CVisits
wrap_CVisits (T_CVisits sem ) (Inh_CVisits _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIchildren _lhsIcon _lhsIcontextMap _lhsIinh _lhsIinstVisitNrs _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamInstMap _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIterminals _lhsIunfoldSemDom _lhsIwith_sig ) =
(let ( _lhsOcomments,_lhsOdecls,_lhsOgatherInstVisitNrs,_lhsOintra,_lhsOintraVars,_lhsOisNil,_lhsOsemNames) =
(sem _lhsIallNts _lhsIallPragmas _lhsIaroundMap _lhsIchildren _lhsIcon _lhsIcontextMap _lhsIinh _lhsIinstVisitNrs _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamInstMap _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIterminals _lhsIunfoldSemDom _lhsIwith_sig )
in (Syn_CVisits _lhsOcomments _lhsOdecls _lhsOgatherInstVisitNrs _lhsOintra _lhsOintraVars _lhsOisNil _lhsOsemNames ))
sem_CVisits_Cons :: T_CVisit ->
T_CVisits ->
T_CVisits
sem_CVisits_Cons (T_CVisit hd_ ) (T_CVisits tl_ ) =
(T_CVisits (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIchildren
_lhsIcon
_lhsIcontextMap
_lhsIinh
_lhsIinstVisitNrs
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamInstMap
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIterminals
_lhsIunfoldSemDom
_lhsIwith_sig ->
(let _tlOnr :: Int
_lhsOisNil :: Bool
_hdOisLast :: Bool
_hdOnextIntra :: Exprs
_hdOnextIntraVars :: (Set String)
_lhsOintra :: Exprs
_lhsOintraVars :: (Set String)
_lhsOdecls :: Decls
_hdOdecls :: Decls
_lhsOcomments :: ([String])
_lhsOgatherInstVisitNrs :: (Map Identifier Int)
_lhsOsemNames :: ([String])
_hdOallNts :: (Set NontermIdent)
_hdOallPragmas :: PragmaMap
_hdOaroundMap :: (Set Identifier)
_hdOchildren :: ([(Identifier,Type, Maybe (Maybe Type))])
_hdOcon :: ConstructorIdent
_hdOcontextMap :: ContextMap
_hdOinh :: Attributes
_hdOinstVisitNrs :: (Map Identifier Int)
_hdOnr :: Int
_hdOnt :: NontermIdent
_hdOo_case :: Bool
_hdOo_cata :: Bool
_hdOo_costcentre :: Bool
_hdOo_data :: (Maybe Bool)
_hdOo_linePragmas :: Bool
_hdOo_monadic :: Bool
_hdOo_newtypes :: Bool
_hdOo_pretty :: Bool
_hdOo_rename :: Bool
_hdOo_sem :: Bool
_hdOo_sig :: Bool
_hdOo_splitsems :: Bool
_hdOo_strictwrap :: Bool
_hdOo_traces :: Bool
_hdOo_unbox :: Bool
_hdOparamInstMap :: (Map Identifier (NontermIdent, [String]))
_hdOparamMap :: ParamMap
_hdOprefix :: String
_hdOsyn :: Attributes
_hdOterminals :: ([Identifier])
_hdOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_hdOwith_sig :: Bool
_tlOallNts :: (Set NontermIdent)
_tlOallPragmas :: PragmaMap
_tlOaroundMap :: (Set Identifier)
_tlOchildren :: ([(Identifier,Type, Maybe (Maybe Type))])
_tlOcon :: ConstructorIdent
_tlOcontextMap :: ContextMap
_tlOinh :: Attributes
_tlOinstVisitNrs :: (Map Identifier Int)
_tlOnt :: NontermIdent
_tlOo_case :: Bool
_tlOo_cata :: Bool
_tlOo_costcentre :: Bool
_tlOo_data :: (Maybe Bool)
_tlOo_linePragmas :: Bool
_tlOo_monadic :: Bool
_tlOo_newtypes :: Bool
_tlOo_pretty :: Bool
_tlOo_rename :: Bool
_tlOo_sem :: Bool
_tlOo_sig :: Bool
_tlOo_splitsems :: Bool
_tlOo_strictwrap :: Bool
_tlOo_traces :: Bool
_tlOo_unbox :: Bool
_tlOparamInstMap :: (Map Identifier (NontermIdent, [String]))
_tlOparamMap :: ParamMap
_tlOprefix :: String
_tlOsyn :: Attributes
_tlOterminals :: ([Identifier])
_tlOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_tlOwith_sig :: Bool
_hdIcomments :: ([String])
_hdIdecls :: Decls
_hdIgatherInstVisitNrs :: (Map Identifier Int)
_hdIintra :: Exprs
_hdIintraVars :: (Set String)
_hdIsemNames :: ([String])
_tlIcomments :: ([String])
_tlIdecls :: Decls
_tlIgatherInstVisitNrs :: (Map Identifier Int)
_tlIintra :: Exprs
_tlIintraVars :: (Set String)
_tlIisNil :: Bool
_tlIsemNames :: ([String])
-- "GenerateCode.ag"(line 244, column 11)
_tlOnr =
({-# LINE 244 "GenerateCode.ag" #-}
_lhsInr + 1
{-# LINE 4992 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 257, column 12)
_lhsOisNil =
({-# LINE 257 "GenerateCode.ag" #-}
False
{-# LINE 4997 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 258, column 12)
_hdOisLast =
({-# LINE 258 "GenerateCode.ag" #-}
_tlIisNil
{-# LINE 5002 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 275, column 12)
_hdOnextIntra =
({-# LINE 275 "GenerateCode.ag" #-}
_tlIintra
{-# LINE 5007 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 276, column 12)
_hdOnextIntraVars =
({-# LINE 276 "GenerateCode.ag" #-}
_tlIintraVars
{-# LINE 5012 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 277, column 12)
_lhsOintra =
({-# LINE 277 "GenerateCode.ag" #-}
_hdIintra
{-# LINE 5017 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 278, column 12)
_lhsOintraVars =
({-# LINE 278 "GenerateCode.ag" #-}
_hdIintraVars
{-# LINE 5022 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 402, column 11)
_lhsOdecls =
({-# LINE 402 "GenerateCode.ag" #-}
_hdIdecls
{-# LINE 5027 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 403, column 11)
_hdOdecls =
({-# LINE 403 "GenerateCode.ag" #-}
_tlIdecls
{-# LINE 5032 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
_hdIcomments ++ _tlIcomments
{-# LINE 5037 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 518, column 44)
_lhsOgatherInstVisitNrs =
({-# LINE 518 "GenerateCode.ag" #-}
_hdIgatherInstVisitNrs `Map.union` _tlIgatherInstVisitNrs
{-# LINE 5042 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 1056, column 61)
_lhsOsemNames =
({-# LINE 1056 "GenerateCode.ag" #-}
_hdIsemNames ++ _tlIsemNames
{-# LINE 5047 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 5052 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOallPragmas =
({-# LINE 67 "GenerateCode.ag" #-}
_lhsIallPragmas
{-# LINE 5057 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOaroundMap =
({-# LINE 537 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 5062 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOchildren =
({-# LINE 381 "GenerateCode.ag" #-}
_lhsIchildren
{-# LINE 5067 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOcon =
({-# LINE 83 "GenerateCode.ag" #-}
_lhsIcon
{-# LINE 5072 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOcontextMap =
({-# LINE 109 "GenerateCode.ag" #-}
_lhsIcontextMap
{-# LINE 5077 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 5082 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOinstVisitNrs =
({-# LINE 517 "GenerateCode.ag" #-}
_lhsIinstVisitNrs
{-# LINE 5087 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOnr =
({-# LINE 240 "GenerateCode.ag" #-}
_lhsInr
{-# LINE 5092 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 5097 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 5102 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 5107 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 5112 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 5117 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 5122 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 5127 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 5132 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 5137 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 5142 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 5147 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 5152 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 5157 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 5162 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 5167 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 5172 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOparamInstMap =
({-# LINE 95 "GenerateCode.ag" #-}
_lhsIparamInstMap
{-# LINE 5177 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 5182 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 5187 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 5192 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOterminals =
({-# LINE 84 "GenerateCode.ag" #-}
_lhsIterminals
{-# LINE 5197 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 5202 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOwith_sig =
({-# LINE 776 "GenerateCode.ag" #-}
_lhsIwith_sig
{-# LINE 5207 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 5212 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOallPragmas =
({-# LINE 67 "GenerateCode.ag" #-}
_lhsIallPragmas
{-# LINE 5217 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOaroundMap =
({-# LINE 537 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 5222 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOchildren =
({-# LINE 381 "GenerateCode.ag" #-}
_lhsIchildren
{-# LINE 5227 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOcon =
({-# LINE 83 "GenerateCode.ag" #-}
_lhsIcon
{-# LINE 5232 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOcontextMap =
({-# LINE 109 "GenerateCode.ag" #-}
_lhsIcontextMap
{-# LINE 5237 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 5242 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOinstVisitNrs =
({-# LINE 517 "GenerateCode.ag" #-}
_lhsIinstVisitNrs
{-# LINE 5247 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 5252 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 5257 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 5262 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 5267 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 5272 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 5277 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 5282 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 5287 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 5292 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 5297 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 5302 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 5307 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 5312 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 5317 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 5322 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 5327 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOparamInstMap =
({-# LINE 95 "GenerateCode.ag" #-}
_lhsIparamInstMap
{-# LINE 5332 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 5337 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 5342 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 5347 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOterminals =
({-# LINE 84 "GenerateCode.ag" #-}
_lhsIterminals
{-# LINE 5352 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 5357 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOwith_sig =
({-# LINE 776 "GenerateCode.ag" #-}
_lhsIwith_sig
{-# LINE 5362 "GenerateCode.hs" #-})
( _hdIcomments,_hdIdecls,_hdIgatherInstVisitNrs,_hdIintra,_hdIintraVars,_hdIsemNames) =
(hd_ _hdOallNts _hdOallPragmas _hdOaroundMap _hdOchildren _hdOcon _hdOcontextMap _hdOdecls _hdOinh _hdOinstVisitNrs _hdOisLast _hdOnextIntra _hdOnextIntraVars _hdOnr _hdOnt _hdOo_case _hdOo_cata _hdOo_costcentre _hdOo_data _hdOo_linePragmas _hdOo_monadic _hdOo_newtypes _hdOo_pretty _hdOo_rename _hdOo_sem _hdOo_sig _hdOo_splitsems _hdOo_strictwrap _hdOo_traces _hdOo_unbox _hdOparamInstMap _hdOparamMap _hdOprefix _hdOsyn _hdOterminals _hdOunfoldSemDom _hdOwith_sig )
( _tlIcomments,_tlIdecls,_tlIgatherInstVisitNrs,_tlIintra,_tlIintraVars,_tlIisNil,_tlIsemNames) =
(tl_ _tlOallNts _tlOallPragmas _tlOaroundMap _tlOchildren _tlOcon _tlOcontextMap _tlOinh _tlOinstVisitNrs _tlOnr _tlOnt _tlOo_case _tlOo_cata _tlOo_costcentre _tlOo_data _tlOo_linePragmas _tlOo_monadic _tlOo_newtypes _tlOo_pretty _tlOo_rename _tlOo_sem _tlOo_sig _tlOo_splitsems _tlOo_strictwrap _tlOo_traces _tlOo_unbox _tlOparamInstMap _tlOparamMap _tlOprefix _tlOsyn _tlOterminals _tlOunfoldSemDom _tlOwith_sig )
in ( _lhsOcomments,_lhsOdecls,_lhsOgatherInstVisitNrs,_lhsOintra,_lhsOintraVars,_lhsOisNil,_lhsOsemNames))) )
sem_CVisits_Nil :: T_CVisits
sem_CVisits_Nil =
(T_CVisits (\ _lhsIallNts
_lhsIallPragmas
_lhsIaroundMap
_lhsIchildren
_lhsIcon
_lhsIcontextMap
_lhsIinh
_lhsIinstVisitNrs
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamInstMap
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIterminals
_lhsIunfoldSemDom
_lhsIwith_sig ->
(let _lhsOisNil :: Bool
_lhsOintra :: Exprs
_lhsOintraVars :: (Set String)
_lhsOdecls :: Decls
_lhsOcomments :: ([String])
_lhsOgatherInstVisitNrs :: (Map Identifier Int)
_lhsOsemNames :: ([String])
-- "GenerateCode.ag"(line 259, column 10)
_lhsOisNil =
({-# LINE 259 "GenerateCode.ag" #-}
True
{-# LINE 5413 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 279, column 10)
_lhsOintra =
({-# LINE 279 "GenerateCode.ag" #-}
[]
{-# LINE 5418 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 280, column 10)
_lhsOintraVars =
({-# LINE 280 "GenerateCode.ag" #-}
Set.empty
{-# LINE 5423 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 401, column 11)
_lhsOdecls =
({-# LINE 401 "GenerateCode.ag" #-}
[]
{-# LINE 5428 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
[]
{-# LINE 5433 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 518, column 44)
_lhsOgatherInstVisitNrs =
({-# LINE 518 "GenerateCode.ag" #-}
Map.empty
{-# LINE 5438 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 1056, column 61)
_lhsOsemNames =
({-# LINE 1056 "GenerateCode.ag" #-}
[]
{-# LINE 5443 "GenerateCode.hs" #-})
in ( _lhsOcomments,_lhsOdecls,_lhsOgatherInstVisitNrs,_lhsOintra,_lhsOintraVars,_lhsOisNil,_lhsOsemNames))) )
-- DeclBlocks --------------------------------------------------
{-
visit 0:
inherited attributes:
blockNr : Int
lastExprVars : [String]
nextVisitDecls : [Decl]
optCase : Bool
prefix : String
synthesized attributes:
callExpr : Expr
decls : [Decl]
freeVars : [String]
alternatives:
alternative DeclBlock:
child defs : {[Decl]}
child visit : {Decl}
child next : DeclBlocks
visit 0:
local lambdaName : _
local pragmaDecl : _
local freeVars : _
local decl : _
alternative DeclTerminator:
child defs : {[Decl]}
child result : {Expr}
visit 0:
local lambdaName : _
local pragmaDecl : _
local freeVars : _
-}
-- cata
sem_DeclBlocks :: DeclBlocks ->
T_DeclBlocks
sem_DeclBlocks (DeclBlock _defs _visit _next ) =
(sem_DeclBlocks_DeclBlock _defs _visit (sem_DeclBlocks _next ) )
sem_DeclBlocks (DeclTerminator _defs _result ) =
(sem_DeclBlocks_DeclTerminator _defs _result )
-- semantic domain
newtype T_DeclBlocks = T_DeclBlocks (Int ->
([String]) ->
([Decl]) ->
Bool ->
String ->
( Expr,([Decl]),([String])))
data Inh_DeclBlocks = Inh_DeclBlocks {blockNr_Inh_DeclBlocks :: !(Int),lastExprVars_Inh_DeclBlocks :: !(([String])),nextVisitDecls_Inh_DeclBlocks :: !(([Decl])),optCase_Inh_DeclBlocks :: !(Bool),prefix_Inh_DeclBlocks :: !(String)}
data Syn_DeclBlocks = Syn_DeclBlocks {callExpr_Syn_DeclBlocks :: !(Expr),decls_Syn_DeclBlocks :: !(([Decl])),freeVars_Syn_DeclBlocks :: !(([String]))}
wrap_DeclBlocks :: T_DeclBlocks ->
Inh_DeclBlocks ->
Syn_DeclBlocks
wrap_DeclBlocks (T_DeclBlocks sem ) (Inh_DeclBlocks _lhsIblockNr _lhsIlastExprVars _lhsInextVisitDecls _lhsIoptCase _lhsIprefix ) =
(let ( _lhsOcallExpr,_lhsOdecls,_lhsOfreeVars) =
(sem _lhsIblockNr _lhsIlastExprVars _lhsInextVisitDecls _lhsIoptCase _lhsIprefix )
in (Syn_DeclBlocks _lhsOcallExpr _lhsOdecls _lhsOfreeVars ))
sem_DeclBlocks_DeclBlock :: ([Decl]) ->
Decl ->
T_DeclBlocks ->
T_DeclBlocks
sem_DeclBlocks_DeclBlock defs_ visit_ (T_DeclBlocks next_ ) =
(T_DeclBlocks (\ _lhsIblockNr
_lhsIlastExprVars
_lhsInextVisitDecls
_lhsIoptCase
_lhsIprefix ->
(let _nextOblockNr :: Int
_lhsOcallExpr :: Expr
_lhsOdecls :: ([Decl])
_lhsOfreeVars :: ([String])
_nextOlastExprVars :: ([String])
_nextOnextVisitDecls :: ([Decl])
_nextOoptCase :: Bool
_nextOprefix :: String
_nextIcallExpr :: Expr
_nextIdecls :: ([Decl])
_nextIfreeVars :: ([String])
-- "GenerateCode.ag"(line 603, column 7)
_nextOblockNr =
({-# LINE 603 "GenerateCode.ag" #-}
_lhsIblockNr + 1
{-# LINE 5524 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 608, column 7)
_lambdaName =
({-# LINE 608 "GenerateCode.ag" #-}
_lhsIprefix ++ "_block" ++ show _lhsIblockNr
{-# LINE 5529 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 609, column 7)
_pragmaDecl =
({-# LINE 609 "GenerateCode.ag" #-}
PragmaDecl ("NOINLINE " ++ _lambdaName )
{-# LINE 5534 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 610, column 7)
_lhsOcallExpr =
({-# LINE 610 "GenerateCode.ag" #-}
App _lambdaName (map SimpleExpr _freeVars )
{-# LINE 5539 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 614, column 7)
_freeVars =
({-# LINE 614 "GenerateCode.ag" #-}
freevars _nextIfreeVars (visit_ : defs_)
{-# LINE 5544 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 621, column 7)
_decl =
({-# LINE 621 "GenerateCode.ag" #-}
mkBlockLambda _lhsIoptCase _lambdaName _freeVars (defs_ ++ [visit_]) _nextIcallExpr
{-# LINE 5549 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 622, column 7)
_lhsOdecls =
({-# LINE 622 "GenerateCode.ag" #-}
(if _lhsIblockNr > 1 then [_pragmaDecl ] else []) ++ [_decl ] ++ _nextIdecls
{-# LINE 5554 "GenerateCode.hs" #-})
-- copy rule (from local)
_lhsOfreeVars =
({-# LINE 605 "GenerateCode.ag" #-}
_freeVars
{-# LINE 5559 "GenerateCode.hs" #-})
-- copy rule (down)
_nextOlastExprVars =
({-# LINE 589 "GenerateCode.ag" #-}
_lhsIlastExprVars
{-# LINE 5564 "GenerateCode.hs" #-})
-- copy rule (down)
_nextOnextVisitDecls =
({-# LINE 589 "GenerateCode.ag" #-}
_lhsInextVisitDecls
{-# LINE 5569 "GenerateCode.hs" #-})
-- copy rule (down)
_nextOoptCase =
({-# LINE 589 "GenerateCode.ag" #-}
_lhsIoptCase
{-# LINE 5574 "GenerateCode.hs" #-})
-- copy rule (down)
_nextOprefix =
({-# LINE 589 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 5579 "GenerateCode.hs" #-})
( _nextIcallExpr,_nextIdecls,_nextIfreeVars) =
(next_ _nextOblockNr _nextOlastExprVars _nextOnextVisitDecls _nextOoptCase _nextOprefix )
in ( _lhsOcallExpr,_lhsOdecls,_lhsOfreeVars))) )
sem_DeclBlocks_DeclTerminator :: ([Decl]) ->
Expr ->
T_DeclBlocks
sem_DeclBlocks_DeclTerminator defs_ result_ =
(T_DeclBlocks (\ _lhsIblockNr
_lhsIlastExprVars
_lhsInextVisitDecls
_lhsIoptCase
_lhsIprefix ->
(let _lhsOcallExpr :: Expr
_lhsOdecls :: ([Decl])
_lhsOfreeVars :: ([String])
-- "GenerateCode.ag"(line 608, column 7)
_lambdaName =
({-# LINE 608 "GenerateCode.ag" #-}
_lhsIprefix ++ "_block" ++ show _lhsIblockNr
{-# LINE 5599 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 609, column 7)
_pragmaDecl =
({-# LINE 609 "GenerateCode.ag" #-}
PragmaDecl ("NOINLINE " ++ _lambdaName )
{-# LINE 5604 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 610, column 7)
_lhsOcallExpr =
({-# LINE 610 "GenerateCode.ag" #-}
App _lambdaName (map SimpleExpr _freeVars )
{-# LINE 5609 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 612, column 7)
_freeVars =
({-# LINE 612 "GenerateCode.ag" #-}
freevars _lhsIlastExprVars (defs_ ++ _lhsInextVisitDecls)
{-# LINE 5614 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 619, column 7)
_lhsOdecls =
({-# LINE 619 "GenerateCode.ag" #-}
[ mkBlockLambda _lhsIoptCase _lambdaName _freeVars (defs_ ++ _lhsInextVisitDecls) result_ ]
{-# LINE 5619 "GenerateCode.hs" #-})
-- copy rule (from local)
_lhsOfreeVars =
({-# LINE 605 "GenerateCode.ag" #-}
_freeVars
{-# LINE 5624 "GenerateCode.hs" #-})
in ( _lhsOcallExpr,_lhsOdecls,_lhsOfreeVars))) )
-- DeclBlocksRoot ----------------------------------------------
{-
visit 0:
inherited attributes:
lastExprVars : [String]
nextVisitDecls : [Decl]
optCase : Bool
prefix : String
synthesized attributes:
firstCall : Expr
lambdas : [Decl]
alternatives:
alternative DeclBlocksRoot:
child blocks : DeclBlocks
-}
-- cata
sem_DeclBlocksRoot :: DeclBlocksRoot ->
T_DeclBlocksRoot
sem_DeclBlocksRoot (DeclBlocksRoot _blocks ) =
(sem_DeclBlocksRoot_DeclBlocksRoot (sem_DeclBlocks _blocks ) )
-- semantic domain
newtype T_DeclBlocksRoot = T_DeclBlocksRoot (([String]) ->
([Decl]) ->
Bool ->
String ->
( Expr,([Decl])))
data Inh_DeclBlocksRoot = Inh_DeclBlocksRoot {lastExprVars_Inh_DeclBlocksRoot :: !(([String])),nextVisitDecls_Inh_DeclBlocksRoot :: !(([Decl])),optCase_Inh_DeclBlocksRoot :: !(Bool),prefix_Inh_DeclBlocksRoot :: !(String)}
data Syn_DeclBlocksRoot = Syn_DeclBlocksRoot {firstCall_Syn_DeclBlocksRoot :: !(Expr),lambdas_Syn_DeclBlocksRoot :: !(([Decl]))}
wrap_DeclBlocksRoot :: T_DeclBlocksRoot ->
Inh_DeclBlocksRoot ->
Syn_DeclBlocksRoot
wrap_DeclBlocksRoot (T_DeclBlocksRoot sem ) (Inh_DeclBlocksRoot _lhsIlastExprVars _lhsInextVisitDecls _lhsIoptCase _lhsIprefix ) =
(let ( _lhsOfirstCall,_lhsOlambdas) =
(sem _lhsIlastExprVars _lhsInextVisitDecls _lhsIoptCase _lhsIprefix )
in (Syn_DeclBlocksRoot _lhsOfirstCall _lhsOlambdas ))
sem_DeclBlocksRoot_DeclBlocksRoot :: T_DeclBlocks ->
T_DeclBlocksRoot
sem_DeclBlocksRoot_DeclBlocksRoot (T_DeclBlocks blocks_ ) =
(T_DeclBlocksRoot (\ _lhsIlastExprVars
_lhsInextVisitDecls
_lhsIoptCase
_lhsIprefix ->
(let _lhsOlambdas :: ([Decl])
_lhsOfirstCall :: Expr
_blocksOblockNr :: Int
_blocksOlastExprVars :: ([String])
_blocksOnextVisitDecls :: ([Decl])
_blocksOoptCase :: Bool
_blocksOprefix :: String
_blocksIcallExpr :: Expr
_blocksIdecls :: ([Decl])
_blocksIfreeVars :: ([String])
-- "GenerateCode.ag"(line 594, column 7)
_lhsOlambdas =
({-# LINE 594 "GenerateCode.ag" #-}
_blocksIdecls
{-# LINE 5682 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 595, column 7)
_lhsOfirstCall =
({-# LINE 595 "GenerateCode.ag" #-}
_blocksIcallExpr
{-# LINE 5687 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 600, column 7)
_blocksOblockNr =
({-# LINE 600 "GenerateCode.ag" #-}
1
{-# LINE 5692 "GenerateCode.hs" #-})
-- copy rule (down)
_blocksOlastExprVars =
({-# LINE 589 "GenerateCode.ag" #-}
_lhsIlastExprVars
{-# LINE 5697 "GenerateCode.hs" #-})
-- copy rule (down)
_blocksOnextVisitDecls =
({-# LINE 589 "GenerateCode.ag" #-}
_lhsInextVisitDecls
{-# LINE 5702 "GenerateCode.hs" #-})
-- copy rule (down)
_blocksOoptCase =
({-# LINE 589 "GenerateCode.ag" #-}
_lhsIoptCase
{-# LINE 5707 "GenerateCode.hs" #-})
-- copy rule (down)
_blocksOprefix =
({-# LINE 589 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 5712 "GenerateCode.hs" #-})
( _blocksIcallExpr,_blocksIdecls,_blocksIfreeVars) =
(blocks_ _blocksOblockNr _blocksOlastExprVars _blocksOnextVisitDecls _blocksOoptCase _blocksOprefix )
in ( _lhsOfirstCall,_lhsOlambdas))) )
-- Pattern -----------------------------------------------------
{-
visit 0:
synthesized attributes:
copy : SELF
definedInsts : [Identifier]
patternAttributes : [(Identifier, Identifier)]
alternatives:
alternative Alias:
child field : {Identifier}
child attr : {Identifier}
child pat : Pattern
child parts : Patterns
visit 0:
local copy : _
alternative Constr:
child name : {ConstructorIdent}
child pats : Patterns
visit 0:
local copy : _
alternative Irrefutable:
child pat : Pattern
visit 0:
local copy : _
alternative Product:
child pos : {Pos}
child pats : Patterns
visit 0:
local copy : _
alternative Underscore:
child pos : {Pos}
visit 0:
local copy : _
-}
-- cata
sem_Pattern :: Pattern ->
T_Pattern
sem_Pattern (Alias _field _attr _pat _parts ) =
(sem_Pattern_Alias _field _attr (sem_Pattern _pat ) (sem_Patterns _parts ) )
sem_Pattern (Constr _name _pats ) =
(sem_Pattern_Constr _name (sem_Patterns _pats ) )
sem_Pattern (Irrefutable _pat ) =
(sem_Pattern_Irrefutable (sem_Pattern _pat ) )
sem_Pattern (Product _pos _pats ) =
(sem_Pattern_Product _pos (sem_Patterns _pats ) )
sem_Pattern (Underscore _pos ) =
(sem_Pattern_Underscore _pos )
-- semantic domain
newtype T_Pattern = T_Pattern (( Pattern ,([Identifier]),([(Identifier, Identifier)])))
data Inh_Pattern = Inh_Pattern {}
data Syn_Pattern = Syn_Pattern {copy_Syn_Pattern :: !(Pattern ),definedInsts_Syn_Pattern :: !(([Identifier])),patternAttributes_Syn_Pattern :: !(([(Identifier, Identifier)]))}
wrap_Pattern :: T_Pattern ->
Inh_Pattern ->
Syn_Pattern
wrap_Pattern (T_Pattern sem ) (Inh_Pattern ) =
(let ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes) =
(sem )
in (Syn_Pattern _lhsOcopy _lhsOdefinedInsts _lhsOpatternAttributes ))
sem_Pattern_Alias :: Identifier ->
Identifier ->
T_Pattern ->
T_Patterns ->
T_Pattern
sem_Pattern_Alias field_ attr_ (T_Pattern pat_ ) (T_Patterns parts_ ) =
(T_Pattern (let _lhsOdefinedInsts :: ([Identifier])
_lhsOpatternAttributes :: ([(Identifier, Identifier)])
_lhsOcopy :: Pattern
_patIcopy :: Pattern
_patIdefinedInsts :: ([Identifier])
_patIpatternAttributes :: ([(Identifier, Identifier)])
_partsIcopy :: Patterns
_partsIdefinedInsts :: ([Identifier])
_partsIpatternAttributes :: ([(Identifier, Identifier)])
-- "GenerateCode.ag"(line 225, column 11)
_lhsOdefinedInsts =
({-# LINE 225 "GenerateCode.ag" #-}
(if field_ == _INST then [attr_] else []) ++ _patIdefinedInsts
{-# LINE 5793 "GenerateCode.hs" #-})
-- "GenerateCode.ag"(line 233, column 7)
_lhsOpatternAttributes =
({-# LINE 233 "GenerateCode.ag" #-}
(field_,attr_) : (_patIpatternAttributes ++ _partsIpatternAttributes)
{-# LINE 5798 "GenerateCode.hs" #-})
-- self rule
_copy =
({-# LINE 23 "./Patterns.ag" #-}
Alias field_ attr_ _patIcopy _partsIcopy
{-# LINE 5803 "GenerateCode.hs" #-})
-- self rule
_lhsOcopy =
({-# LINE 23 "./Patterns.ag" #-}
_copy
{-# LINE 5808 "GenerateCode.hs" #-})
( _patIcopy,_patIdefinedInsts,_patIpatternAttributes) =
(pat_ )
( _partsIcopy,_partsIdefinedInsts,_partsIpatternAttributes) =
(parts_ )
in ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes)) )
sem_Pattern_Constr :: ConstructorIdent ->
T_Patterns ->
T_Pattern
sem_Pattern_Constr name_ (T_Patterns pats_ ) =
(T_Pattern (let _lhsOdefinedInsts :: ([Identifier])
_lhsOpatternAttributes :: ([(Identifier, Identifier)])
_lhsOcopy :: Pattern
_patsIcopy :: Patterns
_patsIdefinedInsts :: ([Identifier])
_patsIpatternAttributes :: ([(Identifier, Identifier)])
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
_patsIdefinedInsts
{-# LINE 5828 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 230, column 47)
_lhsOpatternAttributes =
({-# LINE 230 "GenerateCode.ag" #-}
_patsIpatternAttributes
{-# LINE 5833 "GenerateCode.hs" #-})
-- self rule
_copy =
({-# LINE 23 "./Patterns.ag" #-}
Constr name_ _patsIcopy
{-# LINE 5838 "GenerateCode.hs" #-})
-- self rule
_lhsOcopy =
({-# LINE 23 "./Patterns.ag" #-}
_copy
{-# LINE 5843 "GenerateCode.hs" #-})
( _patsIcopy,_patsIdefinedInsts,_patsIpatternAttributes) =
(pats_ )
in ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes)) )
sem_Pattern_Irrefutable :: T_Pattern ->
T_Pattern
sem_Pattern_Irrefutable (T_Pattern pat_ ) =
(T_Pattern (let _lhsOdefinedInsts :: ([Identifier])
_lhsOpatternAttributes :: ([(Identifier, Identifier)])
_lhsOcopy :: Pattern
_patIcopy :: Pattern
_patIdefinedInsts :: ([Identifier])
_patIpatternAttributes :: ([(Identifier, Identifier)])
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
_patIdefinedInsts
{-# LINE 5860 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 230, column 47)
_lhsOpatternAttributes =
({-# LINE 230 "GenerateCode.ag" #-}
_patIpatternAttributes
{-# LINE 5865 "GenerateCode.hs" #-})
-- self rule
_copy =
({-# LINE 23 "./Patterns.ag" #-}
Irrefutable _patIcopy
{-# LINE 5870 "GenerateCode.hs" #-})
-- self rule
_lhsOcopy =
({-# LINE 23 "./Patterns.ag" #-}
_copy
{-# LINE 5875 "GenerateCode.hs" #-})
( _patIcopy,_patIdefinedInsts,_patIpatternAttributes) =
(pat_ )
in ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes)) )
sem_Pattern_Product :: Pos ->
T_Patterns ->
T_Pattern
sem_Pattern_Product pos_ (T_Patterns pats_ ) =
(T_Pattern (let _lhsOdefinedInsts :: ([Identifier])
_lhsOpatternAttributes :: ([(Identifier, Identifier)])
_lhsOcopy :: Pattern
_patsIcopy :: Patterns
_patsIdefinedInsts :: ([Identifier])
_patsIpatternAttributes :: ([(Identifier, Identifier)])
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
_patsIdefinedInsts
{-# LINE 5893 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 230, column 47)
_lhsOpatternAttributes =
({-# LINE 230 "GenerateCode.ag" #-}
_patsIpatternAttributes
{-# LINE 5898 "GenerateCode.hs" #-})
-- self rule
_copy =
({-# LINE 23 "./Patterns.ag" #-}
Product pos_ _patsIcopy
{-# LINE 5903 "GenerateCode.hs" #-})
-- self rule
_lhsOcopy =
({-# LINE 23 "./Patterns.ag" #-}
_copy
{-# LINE 5908 "GenerateCode.hs" #-})
( _patsIcopy,_patsIdefinedInsts,_patsIpatternAttributes) =
(pats_ )
in ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes)) )
sem_Pattern_Underscore :: Pos ->
T_Pattern
sem_Pattern_Underscore pos_ =
(T_Pattern (let _lhsOdefinedInsts :: ([Identifier])
_lhsOpatternAttributes :: ([(Identifier, Identifier)])
_lhsOcopy :: Pattern
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
[]
{-# LINE 5922 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 230, column 47)
_lhsOpatternAttributes =
({-# LINE 230 "GenerateCode.ag" #-}
[]
{-# LINE 5927 "GenerateCode.hs" #-})
-- self rule
_copy =
({-# LINE 23 "./Patterns.ag" #-}
Underscore pos_
{-# LINE 5932 "GenerateCode.hs" #-})
-- self rule
_lhsOcopy =
({-# LINE 23 "./Patterns.ag" #-}
_copy
{-# LINE 5937 "GenerateCode.hs" #-})
in ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes)) )
-- Patterns ----------------------------------------------------
{-
visit 0:
synthesized attributes:
copy : SELF
definedInsts : [Identifier]
patternAttributes : [(Identifier, Identifier)]
alternatives:
alternative Cons:
child hd : Pattern
child tl : Patterns
visit 0:
local copy : _
alternative Nil:
visit 0:
local copy : _
-}
-- cata
sem_Patterns :: Patterns ->
T_Patterns
sem_Patterns list =
(Prelude.foldr sem_Patterns_Cons sem_Patterns_Nil (Prelude.map sem_Pattern list) )
-- semantic domain
newtype T_Patterns = T_Patterns (( Patterns ,([Identifier]),([(Identifier, Identifier)])))
data Inh_Patterns = Inh_Patterns {}
data Syn_Patterns = Syn_Patterns {copy_Syn_Patterns :: !(Patterns ),definedInsts_Syn_Patterns :: !(([Identifier])),patternAttributes_Syn_Patterns :: !(([(Identifier, Identifier)]))}
wrap_Patterns :: T_Patterns ->
Inh_Patterns ->
Syn_Patterns
wrap_Patterns (T_Patterns sem ) (Inh_Patterns ) =
(let ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes) =
(sem )
in (Syn_Patterns _lhsOcopy _lhsOdefinedInsts _lhsOpatternAttributes ))
sem_Patterns_Cons :: T_Pattern ->
T_Patterns ->
T_Patterns
sem_Patterns_Cons (T_Pattern hd_ ) (T_Patterns tl_ ) =
(T_Patterns (let _lhsOdefinedInsts :: ([Identifier])
_lhsOpatternAttributes :: ([(Identifier, Identifier)])
_lhsOcopy :: Patterns
_hdIcopy :: Pattern
_hdIdefinedInsts :: ([Identifier])
_hdIpatternAttributes :: ([(Identifier, Identifier)])
_tlIcopy :: Patterns
_tlIdefinedInsts :: ([Identifier])
_tlIpatternAttributes :: ([(Identifier, Identifier)])
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
_hdIdefinedInsts ++ _tlIdefinedInsts
{-# LINE 5989 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 230, column 47)
_lhsOpatternAttributes =
({-# LINE 230 "GenerateCode.ag" #-}
_hdIpatternAttributes ++ _tlIpatternAttributes
{-# LINE 5994 "GenerateCode.hs" #-})
-- self rule
_copy =
({-# LINE 23 "./Patterns.ag" #-}
(:) _hdIcopy _tlIcopy
{-# LINE 5999 "GenerateCode.hs" #-})
-- self rule
_lhsOcopy =
({-# LINE 23 "./Patterns.ag" #-}
_copy
{-# LINE 6004 "GenerateCode.hs" #-})
( _hdIcopy,_hdIdefinedInsts,_hdIpatternAttributes) =
(hd_ )
( _tlIcopy,_tlIdefinedInsts,_tlIpatternAttributes) =
(tl_ )
in ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes)) )
sem_Patterns_Nil :: T_Patterns
sem_Patterns_Nil =
(T_Patterns (let _lhsOdefinedInsts :: ([Identifier])
_lhsOpatternAttributes :: ([(Identifier, Identifier)])
_lhsOcopy :: Patterns
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
[]
{-# LINE 6019 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 230, column 47)
_lhsOpatternAttributes =
({-# LINE 230 "GenerateCode.ag" #-}
[]
{-# LINE 6024 "GenerateCode.hs" #-})
-- self rule
_copy =
({-# LINE 23 "./Patterns.ag" #-}
[]
{-# LINE 6029 "GenerateCode.hs" #-})
-- self rule
_lhsOcopy =
({-# LINE 23 "./Patterns.ag" #-}
_copy
{-# LINE 6034 "GenerateCode.hs" #-})
in ( _lhsOcopy,_lhsOdefinedInsts,_lhsOpatternAttributes)) )
-- Sequence ----------------------------------------------------
{-
visit 0:
inherited attributes:
allNts : Set NontermIdent
aroundMap : Set Identifier
children : [(Identifier,Type,Maybe (Maybe Type))]
con : ConstructorIdent
inh : Attributes
instVisitNrs : Map Identifier Int
lastExpr : Expr
nr : Int
nt : NontermIdent
o_case : Bool
o_cata : Bool
o_costcentre : Bool
o_data : Maybe Bool
o_linePragmas : Bool
o_monadic : Bool
o_newtypes : Bool
o_pretty : Bool
o_rename : Bool
o_sem : Bool
o_sig : Bool
o_splitsems : Bool
o_strictwrap : Bool
o_traces : Bool
o_unbox : Bool
paramInstMap : Map Identifier (NontermIdent, [String])
paramMap : ParamMap
prefix : String
syn : Attributes
terminals : [Identifier]
unfoldSemDom : NontermIdent -> Int -> [String] -> Code.Type
what : String
chained attribute:
declsAbove : [Decl]
synthesized attributes:
allTpsFound : Bool
blockDecls : DeclBlocks
comments : [String]
decls : Decls
definedInsts : [Identifier]
exprs : Exprs
tSigs : [Decl]
tps : [Type]
usedVars : Set String
alternatives:
alternative Cons:
child hd : CRule
child tl : Sequence
alternative Nil:
-}
-- cata
sem_Sequence :: Sequence ->
T_Sequence
sem_Sequence list =
(Prelude.foldr sem_Sequence_Cons sem_Sequence_Nil (Prelude.map sem_CRule list) )
-- semantic domain
newtype T_Sequence = T_Sequence ((Set NontermIdent) ->
(Set Identifier) ->
([(Identifier,Type,Maybe (Maybe Type))]) ->
ConstructorIdent ->
([Decl]) ->
Attributes ->
(Map Identifier Int) ->
Expr ->
Int ->
NontermIdent ->
Bool ->
Bool ->
Bool ->
(Maybe Bool) ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
Bool ->
(Map Identifier (NontermIdent, [String])) ->
ParamMap ->
String ->
Attributes ->
([Identifier]) ->
(NontermIdent -> Int -> [String] -> Code.Type) ->
String ->
( Bool,DeclBlocks ,([String]),Decls,([Decl]),([Identifier]),Exprs,([Decl]),([Type]),(Set String)))
data Inh_Sequence = Inh_Sequence {allNts_Inh_Sequence :: !((Set NontermIdent)),aroundMap_Inh_Sequence :: !((Set Identifier)),children_Inh_Sequence :: !(([(Identifier,Type,Maybe (Maybe Type))])),con_Inh_Sequence :: !(ConstructorIdent),declsAbove_Inh_Sequence :: !(([Decl])),inh_Inh_Sequence :: !(Attributes),instVisitNrs_Inh_Sequence :: !((Map Identifier Int)),lastExpr_Inh_Sequence :: !(Expr),nr_Inh_Sequence :: !(Int),nt_Inh_Sequence :: !(NontermIdent),o_case_Inh_Sequence :: !(Bool),o_cata_Inh_Sequence :: !(Bool),o_costcentre_Inh_Sequence :: !(Bool),o_data_Inh_Sequence :: !((Maybe Bool)),o_linePragmas_Inh_Sequence :: !(Bool),o_monadic_Inh_Sequence :: !(Bool),o_newtypes_Inh_Sequence :: !(Bool),o_pretty_Inh_Sequence :: !(Bool),o_rename_Inh_Sequence :: !(Bool),o_sem_Inh_Sequence :: !(Bool),o_sig_Inh_Sequence :: !(Bool),o_splitsems_Inh_Sequence :: !(Bool),o_strictwrap_Inh_Sequence :: !(Bool),o_traces_Inh_Sequence :: !(Bool),o_unbox_Inh_Sequence :: !(Bool),paramInstMap_Inh_Sequence :: !((Map Identifier (NontermIdent, [String]))),paramMap_Inh_Sequence :: !(ParamMap),prefix_Inh_Sequence :: !(String),syn_Inh_Sequence :: !(Attributes),terminals_Inh_Sequence :: !(([Identifier])),unfoldSemDom_Inh_Sequence :: !((NontermIdent -> Int -> [String] -> Code.Type)),what_Inh_Sequence :: !(String)}
data Syn_Sequence = Syn_Sequence {allTpsFound_Syn_Sequence :: !(Bool),blockDecls_Syn_Sequence :: !(DeclBlocks ),comments_Syn_Sequence :: !(([String])),decls_Syn_Sequence :: !(Decls),declsAbove_Syn_Sequence :: !(([Decl])),definedInsts_Syn_Sequence :: !(([Identifier])),exprs_Syn_Sequence :: !(Exprs),tSigs_Syn_Sequence :: !(([Decl])),tps_Syn_Sequence :: !(([Type])),usedVars_Syn_Sequence :: !((Set String))}
wrap_Sequence :: T_Sequence ->
Inh_Sequence ->
Syn_Sequence
wrap_Sequence (T_Sequence sem ) (Inh_Sequence _lhsIallNts _lhsIaroundMap _lhsIchildren _lhsIcon _lhsIdeclsAbove _lhsIinh _lhsIinstVisitNrs _lhsIlastExpr _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamInstMap _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIterminals _lhsIunfoldSemDom _lhsIwhat ) =
(let ( _lhsOallTpsFound,_lhsOblockDecls,_lhsOcomments,_lhsOdecls,_lhsOdeclsAbove,_lhsOdefinedInsts,_lhsOexprs,_lhsOtSigs,_lhsOtps,_lhsOusedVars) =
(sem _lhsIallNts _lhsIaroundMap _lhsIchildren _lhsIcon _lhsIdeclsAbove _lhsIinh _lhsIinstVisitNrs _lhsIlastExpr _lhsInr _lhsInt _lhsIo_case _lhsIo_cata _lhsIo_costcentre _lhsIo_data _lhsIo_linePragmas _lhsIo_monadic _lhsIo_newtypes _lhsIo_pretty _lhsIo_rename _lhsIo_sem _lhsIo_sig _lhsIo_splitsems _lhsIo_strictwrap _lhsIo_traces _lhsIo_unbox _lhsIparamInstMap _lhsIparamMap _lhsIprefix _lhsIsyn _lhsIterminals _lhsIunfoldSemDom _lhsIwhat )
in (Syn_Sequence _lhsOallTpsFound _lhsOblockDecls _lhsOcomments _lhsOdecls _lhsOdeclsAbove _lhsOdefinedInsts _lhsOexprs _lhsOtSigs _lhsOtps _lhsOusedVars ))
sem_Sequence_Cons :: T_CRule ->
T_Sequence ->
T_Sequence
sem_Sequence_Cons (T_CRule hd_ ) (T_Sequence tl_ ) =
(T_Sequence (\ _lhsIallNts
_lhsIaroundMap
_lhsIchildren
_lhsIcon
_lhsIdeclsAbove
_lhsIinh
_lhsIinstVisitNrs
_lhsIlastExpr
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamInstMap
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIterminals
_lhsIunfoldSemDom
_lhsIwhat ->
(let _lhsOblockDecls :: DeclBlocks
_lhsOallTpsFound :: Bool
_lhsOcomments :: ([String])
_lhsOdecls :: Decls
_lhsOdefinedInsts :: ([Identifier])
_lhsOexprs :: Exprs
_lhsOtSigs :: ([Decl])
_lhsOtps :: ([Type])
_lhsOusedVars :: (Set String)
_lhsOdeclsAbove :: ([Decl])
_hdOallNts :: (Set NontermIdent)
_hdOaroundMap :: (Set Identifier)
_hdOchildren :: ([(Identifier,Type,Maybe (Maybe Type))])
_hdOcon :: ConstructorIdent
_hdOdeclsAbove :: ([Decl])
_hdOinh :: Attributes
_hdOinstVisitNrs :: (Map Identifier Int)
_hdOnr :: Int
_hdOnt :: NontermIdent
_hdOo_case :: Bool
_hdOo_cata :: Bool
_hdOo_costcentre :: Bool
_hdOo_data :: (Maybe Bool)
_hdOo_linePragmas :: Bool
_hdOo_monadic :: Bool
_hdOo_newtypes :: Bool
_hdOo_pretty :: Bool
_hdOo_rename :: Bool
_hdOo_sem :: Bool
_hdOo_sig :: Bool
_hdOo_splitsems :: Bool
_hdOo_strictwrap :: Bool
_hdOo_traces :: Bool
_hdOo_unbox :: Bool
_hdOparamInstMap :: (Map Identifier (NontermIdent, [String]))
_hdOparamMap :: ParamMap
_hdOprefix :: String
_hdOsyn :: Attributes
_hdOterminals :: ([Identifier])
_hdOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_hdOwhat :: String
_tlOallNts :: (Set NontermIdent)
_tlOaroundMap :: (Set Identifier)
_tlOchildren :: ([(Identifier,Type,Maybe (Maybe Type))])
_tlOcon :: ConstructorIdent
_tlOdeclsAbove :: ([Decl])
_tlOinh :: Attributes
_tlOinstVisitNrs :: (Map Identifier Int)
_tlOlastExpr :: Expr
_tlOnr :: Int
_tlOnt :: NontermIdent
_tlOo_case :: Bool
_tlOo_cata :: Bool
_tlOo_costcentre :: Bool
_tlOo_data :: (Maybe Bool)
_tlOo_linePragmas :: Bool
_tlOo_monadic :: Bool
_tlOo_newtypes :: Bool
_tlOo_pretty :: Bool
_tlOo_rename :: Bool
_tlOo_sem :: Bool
_tlOo_sig :: Bool
_tlOo_splitsems :: Bool
_tlOo_strictwrap :: Bool
_tlOo_traces :: Bool
_tlOo_unbox :: Bool
_tlOparamInstMap :: (Map Identifier (NontermIdent, [String]))
_tlOparamMap :: ParamMap
_tlOprefix :: String
_tlOsyn :: Attributes
_tlOterminals :: ([Identifier])
_tlOunfoldSemDom :: (NontermIdent -> Int -> [String] -> Code.Type)
_tlOwhat :: String
_hdIallTpsFound :: Bool
_hdIbldBlocksFun :: (DeclBlocks -> DeclBlocks)
_hdIcomments :: ([String])
_hdIdecls :: Decls
_hdIdeclsAbove :: ([Decl])
_hdIdefinedInsts :: ([Identifier])
_hdIexprs :: Exprs
_hdItSigs :: ([Decl])
_hdItps :: ([Type])
_hdIusedVars :: (Set String)
_tlIallTpsFound :: Bool
_tlIblockDecls :: DeclBlocks
_tlIcomments :: ([String])
_tlIdecls :: Decls
_tlIdeclsAbove :: ([Decl])
_tlIdefinedInsts :: ([Identifier])
_tlIexprs :: Exprs
_tlItSigs :: ([Decl])
_tlItps :: ([Type])
_tlIusedVars :: (Set String)
-- "GenerateCode.ag"(line 563, column 7)
_lhsOblockDecls =
({-# LINE 563 "GenerateCode.ag" #-}
_hdIbldBlocksFun _tlIblockDecls
{-# LINE 6270 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 387, column 39)
_lhsOallTpsFound =
({-# LINE 387 "GenerateCode.ag" #-}
_hdIallTpsFound && _tlIallTpsFound
{-# LINE 6275 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
_hdIcomments ++ _tlIcomments
{-# LINE 6280 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 139, column 34)
_lhsOdecls =
({-# LINE 139 "GenerateCode.ag" #-}
_hdIdecls ++ _tlIdecls
{-# LINE 6285 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
_hdIdefinedInsts ++ _tlIdefinedInsts
{-# LINE 6290 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 296, column 34)
_lhsOexprs =
({-# LINE 296 "GenerateCode.ag" #-}
_hdIexprs ++ _tlIexprs
{-# LINE 6295 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 325, column 33)
_lhsOtSigs =
({-# LINE 325 "GenerateCode.ag" #-}
_hdItSigs ++ _tlItSigs
{-# LINE 6300 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 386, column 31)
_lhsOtps =
({-# LINE 386 "GenerateCode.ag" #-}
_hdItps ++ _tlItps
{-# LINE 6305 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 314, column 37)
_lhsOusedVars =
({-# LINE 314 "GenerateCode.ag" #-}
_hdIusedVars `Set.union` _tlIusedVars
{-# LINE 6310 "GenerateCode.hs" #-})
-- copy rule (up)
_lhsOdeclsAbove =
({-# LINE 549 "GenerateCode.ag" #-}
_tlIdeclsAbove
{-# LINE 6315 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 6320 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOaroundMap =
({-# LINE 537 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 6325 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOchildren =
({-# LINE 221 "GenerateCode.ag" #-}
_lhsIchildren
{-# LINE 6330 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOcon =
({-# LINE 83 "GenerateCode.ag" #-}
_lhsIcon
{-# LINE 6335 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOdeclsAbove =
({-# LINE 549 "GenerateCode.ag" #-}
_lhsIdeclsAbove
{-# LINE 6340 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 6345 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOinstVisitNrs =
({-# LINE 517 "GenerateCode.ag" #-}
_lhsIinstVisitNrs
{-# LINE 6350 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOnr =
({-# LINE 240 "GenerateCode.ag" #-}
_lhsInr
{-# LINE 6355 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 6360 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 6365 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 6370 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 6375 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 6380 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 6385 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 6390 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 6395 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 6400 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 6405 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 6410 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 6415 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 6420 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 6425 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 6430 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 6435 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOparamInstMap =
({-# LINE 95 "GenerateCode.ag" #-}
_lhsIparamInstMap
{-# LINE 6440 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 6445 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 6450 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 6455 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOterminals =
({-# LINE 84 "GenerateCode.ag" #-}
_lhsIterminals
{-# LINE 6460 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 6465 "GenerateCode.hs" #-})
-- copy rule (down)
_hdOwhat =
({-# LINE 795 "GenerateCode.ag" #-}
_lhsIwhat
{-# LINE 6470 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOallNts =
({-# LINE 121 "GenerateCode.ag" #-}
_lhsIallNts
{-# LINE 6475 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOaroundMap =
({-# LINE 537 "GenerateCode.ag" #-}
_lhsIaroundMap
{-# LINE 6480 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOchildren =
({-# LINE 221 "GenerateCode.ag" #-}
_lhsIchildren
{-# LINE 6485 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOcon =
({-# LINE 83 "GenerateCode.ag" #-}
_lhsIcon
{-# LINE 6490 "GenerateCode.hs" #-})
-- copy rule (chain)
_tlOdeclsAbove =
({-# LINE 549 "GenerateCode.ag" #-}
_hdIdeclsAbove
{-# LINE 6495 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOinh =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIinh
{-# LINE 6500 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOinstVisitNrs =
({-# LINE 517 "GenerateCode.ag" #-}
_lhsIinstVisitNrs
{-# LINE 6505 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOlastExpr =
({-# LINE 547 "GenerateCode.ag" #-}
_lhsIlastExpr
{-# LINE 6510 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOnr =
({-# LINE 240 "GenerateCode.ag" #-}
_lhsInr
{-# LINE 6515 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOnt =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsInt
{-# LINE 6520 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_case =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_case
{-# LINE 6525 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_cata =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_cata
{-# LINE 6530 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_costcentre =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_costcentre
{-# LINE 6535 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_data =
({-# LINE 46 "GenerateCode.ag" #-}
_lhsIo_data
{-# LINE 6540 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_linePragmas =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_linePragmas
{-# LINE 6545 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_monadic =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_monadic
{-# LINE 6550 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_newtypes =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_newtypes
{-# LINE 6555 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_pretty =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_pretty
{-# LINE 6560 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_rename =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_rename
{-# LINE 6565 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sem =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sem
{-# LINE 6570 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_sig =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_sig
{-# LINE 6575 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_splitsems =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_splitsems
{-# LINE 6580 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_strictwrap =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_strictwrap
{-# LINE 6585 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_traces =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_traces
{-# LINE 6590 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOo_unbox =
({-# LINE 45 "GenerateCode.ag" #-}
_lhsIo_unbox
{-# LINE 6595 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOparamInstMap =
({-# LINE 95 "GenerateCode.ag" #-}
_lhsIparamInstMap
{-# LINE 6600 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOparamMap =
({-# LINE 89 "GenerateCode.ag" #-}
_lhsIparamMap
{-# LINE 6605 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOprefix =
({-# LINE 47 "GenerateCode.ag" #-}
_lhsIprefix
{-# LINE 6610 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOsyn =
({-# LINE 78 "GenerateCode.ag" #-}
_lhsIsyn
{-# LINE 6615 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOterminals =
({-# LINE 84 "GenerateCode.ag" #-}
_lhsIterminals
{-# LINE 6620 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOunfoldSemDom =
({-# LINE 676 "GenerateCode.ag" #-}
_lhsIunfoldSemDom
{-# LINE 6625 "GenerateCode.hs" #-})
-- copy rule (down)
_tlOwhat =
({-# LINE 795 "GenerateCode.ag" #-}
_lhsIwhat
{-# LINE 6630 "GenerateCode.hs" #-})
( _hdIallTpsFound,_hdIbldBlocksFun,_hdIcomments,_hdIdecls,_hdIdeclsAbove,_hdIdefinedInsts,_hdIexprs,_hdItSigs,_hdItps,_hdIusedVars) =
(hd_ _hdOallNts _hdOaroundMap _hdOchildren _hdOcon _hdOdeclsAbove _hdOinh _hdOinstVisitNrs _hdOnr _hdOnt _hdOo_case _hdOo_cata _hdOo_costcentre _hdOo_data _hdOo_linePragmas _hdOo_monadic _hdOo_newtypes _hdOo_pretty _hdOo_rename _hdOo_sem _hdOo_sig _hdOo_splitsems _hdOo_strictwrap _hdOo_traces _hdOo_unbox _hdOparamInstMap _hdOparamMap _hdOprefix _hdOsyn _hdOterminals _hdOunfoldSemDom _hdOwhat )
( _tlIallTpsFound,_tlIblockDecls,_tlIcomments,_tlIdecls,_tlIdeclsAbove,_tlIdefinedInsts,_tlIexprs,_tlItSigs,_tlItps,_tlIusedVars) =
(tl_ _tlOallNts _tlOaroundMap _tlOchildren _tlOcon _tlOdeclsAbove _tlOinh _tlOinstVisitNrs _tlOlastExpr _tlOnr _tlOnt _tlOo_case _tlOo_cata _tlOo_costcentre _tlOo_data _tlOo_linePragmas _tlOo_monadic _tlOo_newtypes _tlOo_pretty _tlOo_rename _tlOo_sem _tlOo_sig _tlOo_splitsems _tlOo_strictwrap _tlOo_traces _tlOo_unbox _tlOparamInstMap _tlOparamMap _tlOprefix _tlOsyn _tlOterminals _tlOunfoldSemDom _tlOwhat )
in ( _lhsOallTpsFound,_lhsOblockDecls,_lhsOcomments,_lhsOdecls,_lhsOdeclsAbove,_lhsOdefinedInsts,_lhsOexprs,_lhsOtSigs,_lhsOtps,_lhsOusedVars))) )
sem_Sequence_Nil :: T_Sequence
sem_Sequence_Nil =
(T_Sequence (\ _lhsIallNts
_lhsIaroundMap
_lhsIchildren
_lhsIcon
_lhsIdeclsAbove
_lhsIinh
_lhsIinstVisitNrs
_lhsIlastExpr
_lhsInr
_lhsInt
_lhsIo_case
_lhsIo_cata
_lhsIo_costcentre
_lhsIo_data
_lhsIo_linePragmas
_lhsIo_monadic
_lhsIo_newtypes
_lhsIo_pretty
_lhsIo_rename
_lhsIo_sem
_lhsIo_sig
_lhsIo_splitsems
_lhsIo_strictwrap
_lhsIo_traces
_lhsIo_unbox
_lhsIparamInstMap
_lhsIparamMap
_lhsIprefix
_lhsIsyn
_lhsIterminals
_lhsIunfoldSemDom
_lhsIwhat ->
(let _lhsOblockDecls :: DeclBlocks
_lhsOallTpsFound :: Bool
_lhsOcomments :: ([String])
_lhsOdecls :: Decls
_lhsOdefinedInsts :: ([Identifier])
_lhsOexprs :: Exprs
_lhsOtSigs :: ([Decl])
_lhsOtps :: ([Type])
_lhsOusedVars :: (Set String)
_lhsOdeclsAbove :: ([Decl])
-- "GenerateCode.ag"(line 565, column 7)
_lhsOblockDecls =
({-# LINE 565 "GenerateCode.ag" #-}
DeclTerminator _lhsIdeclsAbove _lhsIlastExpr
{-# LINE 6684 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 387, column 39)
_lhsOallTpsFound =
({-# LINE 387 "GenerateCode.ag" #-}
True
{-# LINE 6689 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 793, column 52)
_lhsOcomments =
({-# LINE 793 "GenerateCode.ag" #-}
[]
{-# LINE 6694 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 139, column 34)
_lhsOdecls =
({-# LINE 139 "GenerateCode.ag" #-}
[]
{-# LINE 6699 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 223, column 55)
_lhsOdefinedInsts =
({-# LINE 223 "GenerateCode.ag" #-}
[]
{-# LINE 6704 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 296, column 34)
_lhsOexprs =
({-# LINE 296 "GenerateCode.ag" #-}
[]
{-# LINE 6709 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 325, column 33)
_lhsOtSigs =
({-# LINE 325 "GenerateCode.ag" #-}
[]
{-# LINE 6714 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 386, column 31)
_lhsOtps =
({-# LINE 386 "GenerateCode.ag" #-}
[]
{-# LINE 6719 "GenerateCode.hs" #-})
-- use rule "GenerateCode.ag"(line 314, column 37)
_lhsOusedVars =
({-# LINE 314 "GenerateCode.ag" #-}
Set.empty
{-# LINE 6724 "GenerateCode.hs" #-})
-- copy rule (chain)
_lhsOdeclsAbove =
({-# LINE 549 "GenerateCode.ag" #-}
_lhsIdeclsAbove
{-# LINE 6729 "GenerateCode.hs" #-})
in ( _lhsOallTpsFound,_lhsOblockDecls,_lhsOcomments,_lhsOdecls,_lhsOdeclsAbove,_lhsOdefinedInsts,_lhsOexprs,_lhsOtSigs,_lhsOtps,_lhsOusedVars))) )