module KWOrder where
import AbstractSyntax
import HsToken
import Expression
import Patterns
import Options
import PPUtil
import Pretty
import Knuth1
import KennedyWarren
import ExecutionPlan
import Data.Maybe
import Debug.Trace
import Data.Set(Set)
import Data.Map(Map)
import Data.Sequence(Seq)
import qualified Data.Set as Set
import qualified Data.Map as Map
import qualified Data.Sequence as Seq
import Data.Monoid(mappend,mempty)
import Data.Set(Set)
import Data.Map(Map)
import Patterns (Pattern(..),Patterns)
import Expression (Expression(..))
import Macro --marcos
import CommonTypes
import ErrorMessages
import CommonTypes
import UU.Scanner.Position(Pos)
import UU.Scanner.Position(Pos)
import HsToken
import UU.Scanner.Position(Pos)
import CommonTypes (ConstructorIdent,Identifier)
depToEdge :: Dependency -> Edge
depToEdge (Dependency a b) = (occToVertex False b, occToVertex True a)
occToVertex :: Bool -> Occurrence -> Vertex
occToVertex _ (OccRule nm) = VRule nm
occToVertex isDependency (OccAttr c a)
| c == _LOC = VAttr Syn c a
| c == _INST = VChild a
| otherwise = VAttr kind c a where
kind | isDependency && c == _LHS = Inh
| isDependency && c /= _LHS = Syn
| not isDependency && c == _LHS = Syn
| not isDependency && c /= _LHS = Inh
sem_Child :: Child ->
T_Child
sem_Child (Child _name _tp _kind) =
(sem_Child_Child _name _tp _kind)
newtype T_Child = T_Child ((Map Identifier [Expression]) ->
(Map Identifier Attributes) ->
(Map Identifier (Identifier, [Identifier], Expression)) ->
(Set Identifier) ->
Options ->
(Map Identifier Attributes) ->
( EChild,(Set.Set Edge),([(Identifier, Identifier)]),(Set NontermIdent),(Set NontermIdent),(Set.Set Vertex)))
data Inh_Child = Inh_Child {aroundMap_Inh_Child :: (Map Identifier [Expression]),inhMap_Inh_Child :: (Map Identifier Attributes),mergeMap_Inh_Child :: (Map Identifier (Identifier, [Identifier], Expression)),mergedChildren_Inh_Child :: (Set Identifier),options_Inh_Child :: Options,synMap_Inh_Child :: (Map Identifier Attributes)}
data Syn_Child = Syn_Child {echilds_Syn_Child :: EChild,edges_Syn_Child :: (Set.Set Edge),nontnames_Syn_Child :: ([(Identifier, Identifier)]),refHoNts_Syn_Child :: (Set NontermIdent),refNts_Syn_Child :: (Set NontermIdent),vertices_Syn_Child :: (Set.Set Vertex)}
wrap_Child :: T_Child ->
Inh_Child ->
Syn_Child
wrap_Child (T_Child sem) (Inh_Child _lhsIaroundMap _lhsIinhMap _lhsImergeMap _lhsImergedChildren _lhsIoptions _lhsIsynMap) =
(let ( _lhsOechilds,_lhsOedges,_lhsOnontnames,_lhsOrefHoNts,_lhsOrefNts,_lhsOvertices) = sem _lhsIaroundMap _lhsIinhMap _lhsImergeMap _lhsImergedChildren _lhsIoptions _lhsIsynMap
in (Syn_Child _lhsOechilds _lhsOedges _lhsOnontnames _lhsOrefHoNts _lhsOrefNts _lhsOvertices))
sem_Child_Child :: Identifier ->
Type ->
ChildKind ->
T_Child
sem_Child_Child name_ tp_ kind_ =
(T_Child (\ _lhsIaroundMap
_lhsIinhMap
_lhsImergeMap
_lhsImergedChildren
_lhsIoptions
_lhsIsynMap ->
(let _lhsOechilds :: EChild
_lhsOvertices :: (Set.Set Vertex)
_lhsOedges :: (Set.Set Edge)
_lhsOnontnames :: ([(Identifier, Identifier)])
_lhsOrefHoNts :: (Set NontermIdent)
_lhsOrefNts :: (Set NontermIdent)
_refNts =
(
case tp_ of
NT nt _ _ -> Set.singleton nt
_ -> mempty
)
_refHoNts =
(
if _isHigherOrder then _refNts else mempty
)
_isHigherOrder =
(
case kind_ of
ChildSyntax -> False
_ -> True
)
_hasArounds =
(
case Map.lookup name_ _lhsIaroundMap of
Nothing -> False
Just as -> not (null as)
)
_merges =
(
maybe Nothing (\(_,ms,_) -> Just ms) $ Map.lookup name_ _lhsImergeMap
)
_isMerged =
(
name_ `Set.member` _lhsImergedChildren
)
_lhsOechilds =
(
case tp_ of
NT _ _ _ -> EChild name_ tp_ kind_ _hasArounds _merges _isMerged
_ -> ETerm name_ tp_
)
_vertex =
(
VChild name_
)
_synvertices =
(
map (VAttr Syn name_) . Map.keys $ _syn
)
_inhvertices =
(
map (VAttr Inh name_) . Map.keys $ _inh
)
_lhsOvertices =
(
case tp_ of
NT _ _ _ -> Set.insert _vertex $ Set.fromList (_synvertices ++ _inhvertices )
_ -> Set.empty
)
_childIsDeforested =
(
case tp_ of
NT _ _ defor -> defor
_ -> False
)
_higherOrderEdges =
(
case kind_ of
ChildAttr | lateHigherOrderBinding _lhsIoptions && not _childIsDeforested
-> [(_vertex , VAttr Inh _LHS idLateBindingAttr)]
_ -> []
)
_aroundEdges =
(
if _hasArounds
then [(_vertex , VAttr Syn _LOC (Ident (getName name_ ++ "_around") (getPos name_)))]
else []
)
_edgesout =
(
_higherOrderEdges
)
_edgesin =
(
map (flip (,) _vertex ) _synvertices
)
_lhsOedges =
(
Set.fromList (_edgesout ++ _edgesin )
)
_lhsOnontnames =
(
case tp_ of
NT nont _ _ -> [(name_, nont)]
_ -> []
)
_chnt =
(
case tp_ of
NT nt _ _ -> nt
Self -> error ("The type of child " ++ show name_ ++ " should not be a Self type.")
Haskell t -> identifier ""
)
_inh =
(
Map.findWithDefault Map.empty _chnt _lhsIinhMap
)
_syn =
(
Map.findWithDefault Map.empty _chnt _lhsIsynMap
)
_lhsOrefHoNts =
(
_refHoNts
)
_lhsOrefNts =
(
_refNts
)
___node =
(Syn_Child _lhsOechilds _lhsOedges _lhsOnontnames _lhsOrefHoNts _lhsOrefNts _lhsOvertices)
in ( _lhsOechilds,_lhsOedges,_lhsOnontnames,_lhsOrefHoNts,_lhsOrefNts,_lhsOvertices))))
sem_Children :: Children ->
T_Children
sem_Children list =
(Prelude.foldr sem_Children_Cons sem_Children_Nil (Prelude.map sem_Child list))
newtype T_Children = T_Children ((Map Identifier [Expression]) ->
(Map Identifier Attributes) ->
(Map Identifier (Identifier, [Identifier], Expression)) ->
(Set Identifier) ->
Options ->
(Map Identifier Attributes) ->
( EChildren,(Set.Set Edge),([(Identifier, Identifier)]),(Set NontermIdent),(Set NontermIdent),(Set.Set Vertex)))
data Inh_Children = Inh_Children {aroundMap_Inh_Children :: (Map Identifier [Expression]),inhMap_Inh_Children :: (Map Identifier Attributes),mergeMap_Inh_Children :: (Map Identifier (Identifier, [Identifier], Expression)),mergedChildren_Inh_Children :: (Set Identifier),options_Inh_Children :: Options,synMap_Inh_Children :: (Map Identifier Attributes)}
data Syn_Children = Syn_Children {echilds_Syn_Children :: EChildren,edges_Syn_Children :: (Set.Set Edge),nontnames_Syn_Children :: ([(Identifier, Identifier)]),refHoNts_Syn_Children :: (Set NontermIdent),refNts_Syn_Children :: (Set NontermIdent),vertices_Syn_Children :: (Set.Set Vertex)}
wrap_Children :: T_Children ->
Inh_Children ->
Syn_Children
wrap_Children (T_Children sem) (Inh_Children _lhsIaroundMap _lhsIinhMap _lhsImergeMap _lhsImergedChildren _lhsIoptions _lhsIsynMap) =
(let ( _lhsOechilds,_lhsOedges,_lhsOnontnames,_lhsOrefHoNts,_lhsOrefNts,_lhsOvertices) = sem _lhsIaroundMap _lhsIinhMap _lhsImergeMap _lhsImergedChildren _lhsIoptions _lhsIsynMap
in (Syn_Children _lhsOechilds _lhsOedges _lhsOnontnames _lhsOrefHoNts _lhsOrefNts _lhsOvertices))
sem_Children_Cons :: T_Child ->
T_Children ->
T_Children
sem_Children_Cons (T_Child hd_) (T_Children tl_) =
(T_Children (\ _lhsIaroundMap
_lhsIinhMap
_lhsImergeMap
_lhsImergedChildren
_lhsIoptions
_lhsIsynMap ->
(let _lhsOechilds :: EChildren
_lhsOedges :: (Set.Set Edge)
_lhsOnontnames :: ([(Identifier, Identifier)])
_lhsOrefHoNts :: (Set NontermIdent)
_lhsOrefNts :: (Set NontermIdent)
_lhsOvertices :: (Set.Set Vertex)
_hdOaroundMap :: (Map Identifier [Expression])
_hdOinhMap :: (Map Identifier Attributes)
_hdOmergeMap :: (Map Identifier (Identifier, [Identifier], Expression))
_hdOmergedChildren :: (Set Identifier)
_hdOoptions :: Options
_hdOsynMap :: (Map Identifier Attributes)
_tlOaroundMap :: (Map Identifier [Expression])
_tlOinhMap :: (Map Identifier Attributes)
_tlOmergeMap :: (Map Identifier (Identifier, [Identifier], Expression))
_tlOmergedChildren :: (Set Identifier)
_tlOoptions :: Options
_tlOsynMap :: (Map Identifier Attributes)
_hdIechilds :: EChild
_hdIedges :: (Set.Set Edge)
_hdInontnames :: ([(Identifier, Identifier)])
_hdIrefHoNts :: (Set NontermIdent)
_hdIrefNts :: (Set NontermIdent)
_hdIvertices :: (Set.Set Vertex)
_tlIechilds :: EChildren
_tlIedges :: (Set.Set Edge)
_tlInontnames :: ([(Identifier, Identifier)])
_tlIrefHoNts :: (Set NontermIdent)
_tlIrefNts :: (Set NontermIdent)
_tlIvertices :: (Set.Set Vertex)
_lhsOechilds =
(
_hdIechilds : _tlIechilds
)
_lhsOedges =
(
_hdIedges `Set.union` _tlIedges
)
_lhsOnontnames =
(
_hdInontnames ++ _tlInontnames
)
_lhsOrefHoNts =
(
_hdIrefHoNts `mappend` _tlIrefHoNts
)
_lhsOrefNts =
(
_hdIrefNts `mappend` _tlIrefNts
)
_lhsOvertices =
(
_hdIvertices `Set.union` _tlIvertices
)
_hdOaroundMap =
(
_lhsIaroundMap
)
_hdOinhMap =
(
_lhsIinhMap
)
_hdOmergeMap =
(
_lhsImergeMap
)
_hdOmergedChildren =
(
_lhsImergedChildren
)
_hdOoptions =
(
_lhsIoptions
)
_hdOsynMap =
(
_lhsIsynMap
)
_tlOaroundMap =
(
_lhsIaroundMap
)
_tlOinhMap =
(
_lhsIinhMap
)
_tlOmergeMap =
(
_lhsImergeMap
)
_tlOmergedChildren =
(
_lhsImergedChildren
)
_tlOoptions =
(
_lhsIoptions
)
_tlOsynMap =
(
_lhsIsynMap
)
( _hdIechilds,_hdIedges,_hdInontnames,_hdIrefHoNts,_hdIrefNts,_hdIvertices) =
hd_ _hdOaroundMap _hdOinhMap _hdOmergeMap _hdOmergedChildren _hdOoptions _hdOsynMap
( _tlIechilds,_tlIedges,_tlInontnames,_tlIrefHoNts,_tlIrefNts,_tlIvertices) =
tl_ _tlOaroundMap _tlOinhMap _tlOmergeMap _tlOmergedChildren _tlOoptions _tlOsynMap
___node =
(Syn_Children _lhsOechilds _lhsOedges _lhsOnontnames _lhsOrefHoNts _lhsOrefNts _lhsOvertices)
in ( _lhsOechilds,_lhsOedges,_lhsOnontnames,_lhsOrefHoNts,_lhsOrefNts,_lhsOvertices))))
sem_Children_Nil :: T_Children
sem_Children_Nil =
(T_Children (\ _lhsIaroundMap
_lhsIinhMap
_lhsImergeMap
_lhsImergedChildren
_lhsIoptions
_lhsIsynMap ->
(let _lhsOechilds :: EChildren
_lhsOedges :: (Set.Set Edge)
_lhsOnontnames :: ([(Identifier, Identifier)])
_lhsOrefHoNts :: (Set NontermIdent)
_lhsOrefNts :: (Set NontermIdent)
_lhsOvertices :: (Set.Set Vertex)
_lhsOechilds =
(
[]
)
_lhsOedges =
(
Set.empty
)
_lhsOnontnames =
(
[]
)
_lhsOrefHoNts =
(
mempty
)
_lhsOrefNts =
(
mempty
)
_lhsOvertices =
(
Set.empty
)
___node =
(Syn_Children _lhsOechilds _lhsOedges _lhsOnontnames _lhsOrefHoNts _lhsOrefNts _lhsOvertices)
in ( _lhsOechilds,_lhsOedges,_lhsOnontnames,_lhsOrefHoNts,_lhsOrefNts,_lhsOvertices))))
sem_Expression :: Expression ->
T_Expression
sem_Expression (Expression _pos _tks) =
(sem_Expression_Expression _pos _tks)
newtype T_Expression = T_Expression (( Expression,(Set.Set Vertex)))
data Inh_Expression = Inh_Expression {}
data Syn_Expression = Syn_Expression {copy_Syn_Expression :: Expression,vertices_Syn_Expression :: (Set.Set Vertex)}
wrap_Expression :: T_Expression ->
Inh_Expression ->
Syn_Expression
wrap_Expression (T_Expression sem) (Inh_Expression) =
(let ( _lhsOcopy,_lhsOvertices) = sem
in (Syn_Expression _lhsOcopy _lhsOvertices))
sem_Expression_Expression :: Pos ->
([HsToken]) ->
T_Expression
sem_Expression_Expression pos_ tks_ =
(T_Expression (let _lhsOvertices :: (Set.Set Vertex)
_lhsOcopy :: Expression
_lhsOvertices =
(
Set.unions $ map (\tok -> vertices_Syn_HsToken
(wrap_HsToken (sem_HsToken tok) Inh_HsToken)) tks_
)
_copy =
(
Expression pos_ tks_
)
_lhsOcopy =
(
_copy
)
___node =
(Syn_Expression _lhsOcopy _lhsOvertices)
in ( _lhsOcopy,_lhsOvertices)))
sem_Grammar :: Grammar ->
T_Grammar
sem_Grammar (Grammar _typeSyns _useMap _derivings _wrappers _nonts _pragmas _manualAttrOrderMap _paramMap _contextMap _quantMap _uniqueMap _augmentsMap _aroundsMap _mergeMap) =
(sem_Grammar_Grammar _typeSyns _useMap _derivings _wrappers (sem_Nonterminals _nonts) _pragmas _manualAttrOrderMap _paramMap _contextMap _quantMap _uniqueMap _augmentsMap _aroundsMap _mergeMap)
newtype T_Grammar = T_Grammar (Options ->
( PP_Doc,(Seq Error),(Map.Map NontermIdent Attributes),(Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type))),ExecutionPlan,(Map.Map NontermIdent Attributes),PP_Doc))
data Inh_Grammar = Inh_Grammar {options_Inh_Grammar :: Options}
data Syn_Grammar = Syn_Grammar {depgraphs_Syn_Grammar :: PP_Doc,errors_Syn_Grammar :: (Seq Error),inhmap_Syn_Grammar :: (Map.Map NontermIdent Attributes),localSigMap_Syn_Grammar :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type))),output_Syn_Grammar :: ExecutionPlan,synmap_Syn_Grammar :: (Map.Map NontermIdent Attributes),visitgraph_Syn_Grammar :: PP_Doc}
wrap_Grammar :: T_Grammar ->
Inh_Grammar ->
Syn_Grammar
wrap_Grammar (T_Grammar sem) (Inh_Grammar _lhsIoptions) =
(let ( _lhsOdepgraphs,_lhsOerrors,_lhsOinhmap,_lhsOlocalSigMap,_lhsOoutput,_lhsOsynmap,_lhsOvisitgraph) = sem _lhsIoptions
in (Syn_Grammar _lhsOdepgraphs _lhsOerrors _lhsOinhmap _lhsOlocalSigMap _lhsOoutput _lhsOsynmap _lhsOvisitgraph))
sem_Grammar_Grammar :: TypeSyns ->
UseMap ->
Derivings ->
(Set NontermIdent) ->
T_Nonterminals ->
PragmaMap ->
AttrOrderMap ->
ParamMap ->
ContextMap ->
QuantMap ->
UniqueMap ->
(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ->
(Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ->
(Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))) ->
T_Grammar
sem_Grammar_Grammar typeSyns_ useMap_ derivings_ wrappers_ (T_Nonterminals nonts_) pragmas_ manualAttrOrderMap_ paramMap_ contextMap_ quantMap_ uniqueMap_ augmentsMap_ aroundsMap_ mergeMap_ =
(T_Grammar (\ _lhsIoptions ->
(let _nontsOrulenumber :: Int
_nontsOaroundMap :: (Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression])))
_nontsOmergeMap :: (Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))))
_nontsOclassContexts :: ContextMap
_nontsOmanualDeps :: AttrOrderMap
_lhsOoutput :: ExecutionPlan
_lhsOdepgraphs :: PP_Doc
_lhsOvisitgraph :: PP_Doc
_lhsOerrors :: (Seq Error)
_nontsOinhMap :: (Map Identifier Attributes)
_nontsOsynMap :: (Map Identifier Attributes)
_lhsOinhmap :: (Map.Map NontermIdent Attributes)
_lhsOlocalSigMap :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type)))
_lhsOsynmap :: (Map.Map NontermIdent Attributes)
_nontsOclosedHoNtDeps :: (Map NontermIdent (Set NontermIdent))
_nontsOclosedHoNtRevDeps :: (Map NontermIdent (Set NontermIdent))
_nontsOclosedNtDeps :: (Map NontermIdent (Set NontermIdent))
_nontsOoptions :: Options
_nontsIdepinfo :: ([NontDependencyInformation])
_nontsIinhMap' :: (Map Identifier Attributes)
_nontsIinhmap :: (Map.Map NontermIdent Attributes)
_nontsIlocalSigMap :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type)))
_nontsIntDeps :: (Map NontermIdent (Set NontermIdent))
_nontsIntHoDeps :: (Map NontermIdent (Set NontermIdent))
_nontsIrulenumber :: Int
_nontsIsynMap' :: (Map Identifier Attributes)
_nontsIsynmap :: (Map.Map NontermIdent Attributes)
_nontsOrulenumber =
(
0
)
_closedNtDeps =
(
closeMap _nontsIntDeps
)
_closedHoNtDeps =
(
closeMap _nontsIntHoDeps
)
_closedHoNtRevDeps =
(
revDeps _closedHoNtDeps
)
_nontsOaroundMap =
(
aroundsMap_
)
_nontsOmergeMap =
(
mergeMap_
)
_nontsOclassContexts =
(
contextMap_
)
_nontsOmanualDeps =
(
manualAttrOrderMap_
)
(_lhsOoutput,_lhsOdepgraphs,_lhsOvisitgraph,_lhsOerrors) =
(
let lazyPlan = kennedyWarrenLazy _lhsIoptions wrappers_ _nontsIdepinfo typeSyns_ derivings_
in if visit _lhsIoptions
then case kennedyWarrenOrder _lhsIoptions wrappers_ _nontsIdepinfo typeSyns_ derivings_ of
Left e -> (lazyPlan,empty,empty,Seq.singleton e)
Right (o,d,v) -> (o,d,v,Seq.empty)
else (lazyPlan,empty,empty,Seq.empty)
)
_nontsOinhMap =
(
_nontsIinhMap'
)
_nontsOsynMap =
(
_nontsIsynMap'
)
_lhsOinhmap =
(
_nontsIinhmap
)
_lhsOlocalSigMap =
(
_nontsIlocalSigMap
)
_lhsOsynmap =
(
_nontsIsynmap
)
_nontsOclosedHoNtDeps =
(
_closedHoNtDeps
)
_nontsOclosedHoNtRevDeps =
(
_closedHoNtRevDeps
)
_nontsOclosedNtDeps =
(
_closedNtDeps
)
_nontsOoptions =
(
_lhsIoptions
)
( _nontsIdepinfo,_nontsIinhMap',_nontsIinhmap,_nontsIlocalSigMap,_nontsIntDeps,_nontsIntHoDeps,_nontsIrulenumber,_nontsIsynMap',_nontsIsynmap) =
nonts_ _nontsOaroundMap _nontsOclassContexts _nontsOclosedHoNtDeps _nontsOclosedHoNtRevDeps _nontsOclosedNtDeps _nontsOinhMap _nontsOmanualDeps _nontsOmergeMap _nontsOoptions _nontsOrulenumber _nontsOsynMap
___node =
(Syn_Grammar _lhsOdepgraphs _lhsOerrors _lhsOinhmap _lhsOlocalSigMap _lhsOoutput _lhsOsynmap _lhsOvisitgraph)
in ( _lhsOdepgraphs,_lhsOerrors,_lhsOinhmap,_lhsOlocalSigMap,_lhsOoutput,_lhsOsynmap,_lhsOvisitgraph))))
sem_HsToken :: HsToken ->
T_HsToken
sem_HsToken (AGField _field _attr _pos _rdesc) =
(sem_HsToken_AGField _field _attr _pos _rdesc)
sem_HsToken (AGLocal _var _pos _rdesc) =
(sem_HsToken_AGLocal _var _pos _rdesc)
sem_HsToken (CharToken _value _pos) =
(sem_HsToken_CharToken _value _pos)
sem_HsToken (Err _mesg _pos) =
(sem_HsToken_Err _mesg _pos)
sem_HsToken (HsToken _value _pos) =
(sem_HsToken_HsToken _value _pos)
sem_HsToken (StrToken _value _pos) =
(sem_HsToken_StrToken _value _pos)
newtype T_HsToken = T_HsToken (( (Set.Set Vertex)))
data Inh_HsToken = Inh_HsToken {}
data Syn_HsToken = Syn_HsToken {vertices_Syn_HsToken :: (Set.Set Vertex)}
wrap_HsToken :: T_HsToken ->
Inh_HsToken ->
Syn_HsToken
wrap_HsToken (T_HsToken sem) (Inh_HsToken) =
(let ( _lhsOvertices) = sem
in (Syn_HsToken _lhsOvertices))
sem_HsToken_AGField :: Identifier ->
Identifier ->
Pos ->
(Maybe String) ->
T_HsToken
sem_HsToken_AGField field_ attr_ pos_ rdesc_ =
(T_HsToken (let _lhsOvertices :: (Set.Set Vertex)
_lhsOvertices =
(
Set.singleton $ VAttr (if field_ == _LHS then Inh
else if field_ == _LOC then Loc
else Syn) field_ attr_
)
___node =
(Syn_HsToken _lhsOvertices)
in ( _lhsOvertices)))
sem_HsToken_AGLocal :: Identifier ->
Pos ->
(Maybe String) ->
T_HsToken
sem_HsToken_AGLocal var_ pos_ rdesc_ =
(T_HsToken (let _lhsOvertices :: (Set.Set Vertex)
_lhsOvertices =
(
Set.singleton $ VChild var_
)
___node =
(Syn_HsToken _lhsOvertices)
in ( _lhsOvertices)))
sem_HsToken_CharToken :: String ->
Pos ->
T_HsToken
sem_HsToken_CharToken value_ pos_ =
(T_HsToken (let _lhsOvertices :: (Set.Set Vertex)
_lhsOvertices =
(
Set.empty
)
___node =
(Syn_HsToken _lhsOvertices)
in ( _lhsOvertices)))
sem_HsToken_Err :: String ->
Pos ->
T_HsToken
sem_HsToken_Err mesg_ pos_ =
(T_HsToken (let _lhsOvertices :: (Set.Set Vertex)
_lhsOvertices =
(
Set.empty
)
___node =
(Syn_HsToken _lhsOvertices)
in ( _lhsOvertices)))
sem_HsToken_HsToken :: String ->
Pos ->
T_HsToken
sem_HsToken_HsToken value_ pos_ =
(T_HsToken (let _lhsOvertices :: (Set.Set Vertex)
_lhsOvertices =
(
Set.empty
)
___node =
(Syn_HsToken _lhsOvertices)
in ( _lhsOvertices)))
sem_HsToken_StrToken :: String ->
Pos ->
T_HsToken
sem_HsToken_StrToken value_ pos_ =
(T_HsToken (let _lhsOvertices :: (Set.Set Vertex)
_lhsOvertices =
(
Set.empty
)
___node =
(Syn_HsToken _lhsOvertices)
in ( _lhsOvertices)))
sem_HsTokens :: HsTokens ->
T_HsTokens
sem_HsTokens list =
(Prelude.foldr sem_HsTokens_Cons sem_HsTokens_Nil (Prelude.map sem_HsToken list))
newtype T_HsTokens = T_HsTokens (( ))
data Inh_HsTokens = Inh_HsTokens {}
data Syn_HsTokens = Syn_HsTokens {}
wrap_HsTokens :: T_HsTokens ->
Inh_HsTokens ->
Syn_HsTokens
wrap_HsTokens (T_HsTokens sem) (Inh_HsTokens) =
(let ( ) = sem
in (Syn_HsTokens))
sem_HsTokens_Cons :: T_HsToken ->
T_HsTokens ->
T_HsTokens
sem_HsTokens_Cons (T_HsToken hd_) (T_HsTokens tl_) =
(T_HsTokens (let _hdIvertices :: (Set.Set Vertex)
( _hdIvertices) =
hd_
___node =
(Syn_HsTokens)
in ( )))
sem_HsTokens_Nil :: T_HsTokens
sem_HsTokens_Nil =
(T_HsTokens (let ___node =
(Syn_HsTokens)
in ( )))
sem_HsTokensRoot :: HsTokensRoot ->
T_HsTokensRoot
sem_HsTokensRoot (HsTokensRoot _tokens) =
(sem_HsTokensRoot_HsTokensRoot (sem_HsTokens _tokens))
newtype T_HsTokensRoot = T_HsTokensRoot (( ))
data Inh_HsTokensRoot = Inh_HsTokensRoot {}
data Syn_HsTokensRoot = Syn_HsTokensRoot {}
wrap_HsTokensRoot :: T_HsTokensRoot ->
Inh_HsTokensRoot ->
Syn_HsTokensRoot
wrap_HsTokensRoot (T_HsTokensRoot sem) (Inh_HsTokensRoot) =
(let ( ) = sem
in (Syn_HsTokensRoot))
sem_HsTokensRoot_HsTokensRoot :: T_HsTokens ->
T_HsTokensRoot
sem_HsTokensRoot_HsTokensRoot (T_HsTokens tokens_) =
(T_HsTokensRoot (let ___node =
(Syn_HsTokensRoot)
in ( )))
sem_Nonterminal :: Nonterminal ->
T_Nonterminal
sem_Nonterminal (Nonterminal _nt _params _inh _syn _prods) =
(sem_Nonterminal_Nonterminal _nt _params _inh _syn (sem_Productions _prods))
newtype T_Nonterminal = T_Nonterminal ((Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ->
ContextMap ->
(Map NontermIdent (Set NontermIdent)) ->
(Map NontermIdent (Set NontermIdent)) ->
(Map NontermIdent (Set NontermIdent)) ->
(Map Identifier Attributes) ->
AttrOrderMap ->
(Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))) ->
Options ->
Int ->
(Map Identifier Attributes) ->
( NontDependencyInformation,(Map Identifier Attributes),(Map.Map NontermIdent Attributes),(Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type))),(Map NontermIdent (Set NontermIdent)),(Map NontermIdent (Set NontermIdent)),Int,(Map Identifier Attributes),(Map.Map NontermIdent Attributes)))
data Inh_Nonterminal = Inh_Nonterminal {aroundMap_Inh_Nonterminal :: (Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))),classContexts_Inh_Nonterminal :: ContextMap,closedHoNtDeps_Inh_Nonterminal :: (Map NontermIdent (Set NontermIdent)),closedHoNtRevDeps_Inh_Nonterminal :: (Map NontermIdent (Set NontermIdent)),closedNtDeps_Inh_Nonterminal :: (Map NontermIdent (Set NontermIdent)),inhMap_Inh_Nonterminal :: (Map Identifier Attributes),manualDeps_Inh_Nonterminal :: AttrOrderMap,mergeMap_Inh_Nonterminal :: (Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))),options_Inh_Nonterminal :: Options,rulenumber_Inh_Nonterminal :: Int,synMap_Inh_Nonterminal :: (Map Identifier Attributes)}
data Syn_Nonterminal = Syn_Nonterminal {depinfo_Syn_Nonterminal :: NontDependencyInformation,inhMap'_Syn_Nonterminal :: (Map Identifier Attributes),inhmap_Syn_Nonterminal :: (Map.Map NontermIdent Attributes),localSigMap_Syn_Nonterminal :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type))),ntDeps_Syn_Nonterminal :: (Map NontermIdent (Set NontermIdent)),ntHoDeps_Syn_Nonterminal :: (Map NontermIdent (Set NontermIdent)),rulenumber_Syn_Nonterminal :: Int,synMap'_Syn_Nonterminal :: (Map Identifier Attributes),synmap_Syn_Nonterminal :: (Map.Map NontermIdent Attributes)}
wrap_Nonterminal :: T_Nonterminal ->
Inh_Nonterminal ->
Syn_Nonterminal
wrap_Nonterminal (T_Nonterminal sem) (Inh_Nonterminal _lhsIaroundMap _lhsIclassContexts _lhsIclosedHoNtDeps _lhsIclosedHoNtRevDeps _lhsIclosedNtDeps _lhsIinhMap _lhsImanualDeps _lhsImergeMap _lhsIoptions _lhsIrulenumber _lhsIsynMap) =
(let ( _lhsOdepinfo,_lhsOinhMap',_lhsOinhmap,_lhsOlocalSigMap,_lhsOntDeps,_lhsOntHoDeps,_lhsOrulenumber,_lhsOsynMap',_lhsOsynmap) = sem _lhsIaroundMap _lhsIclassContexts _lhsIclosedHoNtDeps _lhsIclosedHoNtRevDeps _lhsIclosedNtDeps _lhsIinhMap _lhsImanualDeps _lhsImergeMap _lhsIoptions _lhsIrulenumber _lhsIsynMap
in (Syn_Nonterminal _lhsOdepinfo _lhsOinhMap' _lhsOinhmap _lhsOlocalSigMap _lhsOntDeps _lhsOntHoDeps _lhsOrulenumber _lhsOsynMap' _lhsOsynmap))
sem_Nonterminal_Nonterminal :: NontermIdent ->
([Identifier]) ->
Attributes ->
Attributes ->
T_Productions ->
T_Nonterminal
sem_Nonterminal_Nonterminal nt_ params_ inh_ syn_ (T_Productions prods_) =
(T_Nonterminal (\ _lhsIaroundMap
_lhsIclassContexts
_lhsIclosedHoNtDeps
_lhsIclosedHoNtRevDeps
_lhsIclosedNtDeps
_lhsIinhMap
_lhsImanualDeps
_lhsImergeMap
_lhsIoptions
_lhsIrulenumber
_lhsIsynMap ->
(let _lhsOntDeps :: (Map NontermIdent (Set NontermIdent))
_lhsOntHoDeps :: (Map NontermIdent (Set NontermIdent))
_prodsOmanualDeps :: (Map ConstructorIdent (Set Dependency))
_lhsOdepinfo :: NontDependencyInformation
_lhsOinhmap :: (Map.Map NontermIdent Attributes)
_lhsOsynmap :: (Map.Map NontermIdent Attributes)
_lhsOlocalSigMap :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type)))
_lhsOinhMap' :: (Map Identifier Attributes)
_lhsOsynMap' :: (Map Identifier Attributes)
_lhsOrulenumber :: Int
_prodsOaroundMap :: (Map ConstructorIdent (Map Identifier [Expression]))
_prodsOinhMap :: (Map Identifier Attributes)
_prodsOmergeMap :: (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))
_prodsOoptions :: Options
_prodsOrulenumber :: Int
_prodsOsynMap :: (Map Identifier Attributes)
_prodsIdepgraph :: ([ProdDependencyGraph])
_prodsIlocalSigMap :: (Map.Map ConstructorIdent (Map.Map Identifier Type))
_prodsIrefHoNts :: (Set NontermIdent)
_prodsIrefNts :: (Set NontermIdent)
_prodsIrulenumber :: Int
_lhsOntDeps =
(
Map.singleton nt_ _prodsIrefNts
)
_lhsOntHoDeps =
(
Map.singleton nt_ _prodsIrefHoNts
)
_closedNtDeps =
(
Map.findWithDefault Set.empty nt_ _lhsIclosedNtDeps
)
_closedHoNtDeps =
(
Map.findWithDefault Set.empty nt_ _lhsIclosedHoNtDeps
)
_closedHoNtRevDeps =
(
Map.findWithDefault Set.empty nt_ _lhsIclosedHoNtRevDeps
)
_recursive =
(
nt_ `Set.member` _closedNtDeps
)
_nontrivAcyc =
(
nt_ `Set.member` _closedHoNtDeps
)
_hoInfo =
(
HigherOrderInfo { hoNtDeps = _closedHoNtDeps
, hoNtRevDeps = _closedHoNtRevDeps
, hoAcyclic = _nontrivAcyc
}
)
_aroundMap =
(
Map.findWithDefault Map.empty nt_ _lhsIaroundMap
)
_mergeMap =
(
Map.findWithDefault Map.empty nt_ _lhsImergeMap
)
_classContexts =
(
Map.findWithDefault [] nt_ _lhsIclassContexts
)
_prodsOmanualDeps =
(
Map.findWithDefault Map.empty nt_ _lhsImanualDeps
)
_synvertices =
(
map (VAttr Syn nt_) . Map.keys $ syn_
)
_inhvertices =
(
map (VAttr Inh nt_) . Map.keys $ inh_
)
_vertices =
(
_synvertices ++ _inhvertices
)
_nontgraph =
(
NontDependencyGraph { ndgVertices = _vertices
, ndgEdges = [] }
)
_lhsOdepinfo =
(
NontDependencyInformation { ndiNonterminal = nt_
, ndiParams = params_
, ndiInh = Map.keys inh_
, ndiSyn = Map.keys syn_
, ndiDepGraph = _nontgraph
, ndiProds = _prodsIdepgraph
, ndiRecursive = _recursive
, ndiHoInfo = _hoInfo
, ndiClassCtxs = _classContexts
}
)
_lhsOinhmap =
(
Map.singleton nt_ inh_
)
_lhsOsynmap =
(
Map.singleton nt_ syn_
)
_lhsOlocalSigMap =
(
Map.singleton nt_ _prodsIlocalSigMap
)
_lhsOinhMap' =
(
Map.singleton nt_ inh_
)
_lhsOsynMap' =
(
Map.singleton nt_ syn_
)
_lhsOrulenumber =
(
_prodsIrulenumber
)
_prodsOaroundMap =
(
_aroundMap
)
_prodsOinhMap =
(
_lhsIinhMap
)
_prodsOmergeMap =
(
_mergeMap
)
_prodsOoptions =
(
_lhsIoptions
)
_prodsOrulenumber =
(
_lhsIrulenumber
)
_prodsOsynMap =
(
_lhsIsynMap
)
( _prodsIdepgraph,_prodsIlocalSigMap,_prodsIrefHoNts,_prodsIrefNts,_prodsIrulenumber) =
prods_ _prodsOaroundMap _prodsOinhMap _prodsOmanualDeps _prodsOmergeMap _prodsOoptions _prodsOrulenumber _prodsOsynMap
___node =
(Syn_Nonterminal _lhsOdepinfo _lhsOinhMap' _lhsOinhmap _lhsOlocalSigMap _lhsOntDeps _lhsOntHoDeps _lhsOrulenumber _lhsOsynMap' _lhsOsynmap)
in ( _lhsOdepinfo,_lhsOinhMap',_lhsOinhmap,_lhsOlocalSigMap,_lhsOntDeps,_lhsOntHoDeps,_lhsOrulenumber,_lhsOsynMap',_lhsOsynmap))))
sem_Nonterminals :: Nonterminals ->
T_Nonterminals
sem_Nonterminals list =
(Prelude.foldr sem_Nonterminals_Cons sem_Nonterminals_Nil (Prelude.map sem_Nonterminal list))
newtype T_Nonterminals = T_Nonterminals ((Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) ->
ContextMap ->
(Map NontermIdent (Set NontermIdent)) ->
(Map NontermIdent (Set NontermIdent)) ->
(Map NontermIdent (Set NontermIdent)) ->
(Map Identifier Attributes) ->
AttrOrderMap ->
(Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))) ->
Options ->
Int ->
(Map Identifier Attributes) ->
( ([NontDependencyInformation]),(Map Identifier Attributes),(Map.Map NontermIdent Attributes),(Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type))),(Map NontermIdent (Set NontermIdent)),(Map NontermIdent (Set NontermIdent)),Int,(Map Identifier Attributes),(Map.Map NontermIdent Attributes)))
data Inh_Nonterminals = Inh_Nonterminals {aroundMap_Inh_Nonterminals :: (Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))),classContexts_Inh_Nonterminals :: ContextMap,closedHoNtDeps_Inh_Nonterminals :: (Map NontermIdent (Set NontermIdent)),closedHoNtRevDeps_Inh_Nonterminals :: (Map NontermIdent (Set NontermIdent)),closedNtDeps_Inh_Nonterminals :: (Map NontermIdent (Set NontermIdent)),inhMap_Inh_Nonterminals :: (Map Identifier Attributes),manualDeps_Inh_Nonterminals :: AttrOrderMap,mergeMap_Inh_Nonterminals :: (Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))),options_Inh_Nonterminals :: Options,rulenumber_Inh_Nonterminals :: Int,synMap_Inh_Nonterminals :: (Map Identifier Attributes)}
data Syn_Nonterminals = Syn_Nonterminals {depinfo_Syn_Nonterminals :: ([NontDependencyInformation]),inhMap'_Syn_Nonterminals :: (Map Identifier Attributes),inhmap_Syn_Nonterminals :: (Map.Map NontermIdent Attributes),localSigMap_Syn_Nonterminals :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type))),ntDeps_Syn_Nonterminals :: (Map NontermIdent (Set NontermIdent)),ntHoDeps_Syn_Nonterminals :: (Map NontermIdent (Set NontermIdent)),rulenumber_Syn_Nonterminals :: Int,synMap'_Syn_Nonterminals :: (Map Identifier Attributes),synmap_Syn_Nonterminals :: (Map.Map NontermIdent Attributes)}
wrap_Nonterminals :: T_Nonterminals ->
Inh_Nonterminals ->
Syn_Nonterminals
wrap_Nonterminals (T_Nonterminals sem) (Inh_Nonterminals _lhsIaroundMap _lhsIclassContexts _lhsIclosedHoNtDeps _lhsIclosedHoNtRevDeps _lhsIclosedNtDeps _lhsIinhMap _lhsImanualDeps _lhsImergeMap _lhsIoptions _lhsIrulenumber _lhsIsynMap) =
(let ( _lhsOdepinfo,_lhsOinhMap',_lhsOinhmap,_lhsOlocalSigMap,_lhsOntDeps,_lhsOntHoDeps,_lhsOrulenumber,_lhsOsynMap',_lhsOsynmap) = sem _lhsIaroundMap _lhsIclassContexts _lhsIclosedHoNtDeps _lhsIclosedHoNtRevDeps _lhsIclosedNtDeps _lhsIinhMap _lhsImanualDeps _lhsImergeMap _lhsIoptions _lhsIrulenumber _lhsIsynMap
in (Syn_Nonterminals _lhsOdepinfo _lhsOinhMap' _lhsOinhmap _lhsOlocalSigMap _lhsOntDeps _lhsOntHoDeps _lhsOrulenumber _lhsOsynMap' _lhsOsynmap))
sem_Nonterminals_Cons :: T_Nonterminal ->
T_Nonterminals ->
T_Nonterminals
sem_Nonterminals_Cons (T_Nonterminal hd_) (T_Nonterminals tl_) =
(T_Nonterminals (\ _lhsIaroundMap
_lhsIclassContexts
_lhsIclosedHoNtDeps
_lhsIclosedHoNtRevDeps
_lhsIclosedNtDeps
_lhsIinhMap
_lhsImanualDeps
_lhsImergeMap
_lhsIoptions
_lhsIrulenumber
_lhsIsynMap ->
(let _lhsOdepinfo :: ([NontDependencyInformation])
_lhsOinhMap' :: (Map Identifier Attributes)
_lhsOinhmap :: (Map.Map NontermIdent Attributes)
_lhsOlocalSigMap :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type)))
_lhsOntDeps :: (Map NontermIdent (Set NontermIdent))
_lhsOntHoDeps :: (Map NontermIdent (Set NontermIdent))
_lhsOsynMap' :: (Map Identifier Attributes)
_lhsOsynmap :: (Map.Map NontermIdent Attributes)
_lhsOrulenumber :: Int
_hdOaroundMap :: (Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression])))
_hdOclassContexts :: ContextMap
_hdOclosedHoNtDeps :: (Map NontermIdent (Set NontermIdent))
_hdOclosedHoNtRevDeps :: (Map NontermIdent (Set NontermIdent))
_hdOclosedNtDeps :: (Map NontermIdent (Set NontermIdent))
_hdOinhMap :: (Map Identifier Attributes)
_hdOmanualDeps :: AttrOrderMap
_hdOmergeMap :: (Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))))
_hdOoptions :: Options
_hdOrulenumber :: Int
_hdOsynMap :: (Map Identifier Attributes)
_tlOaroundMap :: (Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression])))
_tlOclassContexts :: ContextMap
_tlOclosedHoNtDeps :: (Map NontermIdent (Set NontermIdent))
_tlOclosedHoNtRevDeps :: (Map NontermIdent (Set NontermIdent))
_tlOclosedNtDeps :: (Map NontermIdent (Set NontermIdent))
_tlOinhMap :: (Map Identifier Attributes)
_tlOmanualDeps :: AttrOrderMap
_tlOmergeMap :: (Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))))
_tlOoptions :: Options
_tlOrulenumber :: Int
_tlOsynMap :: (Map Identifier Attributes)
_hdIdepinfo :: NontDependencyInformation
_hdIinhMap' :: (Map Identifier Attributes)
_hdIinhmap :: (Map.Map NontermIdent Attributes)
_hdIlocalSigMap :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type)))
_hdIntDeps :: (Map NontermIdent (Set NontermIdent))
_hdIntHoDeps :: (Map NontermIdent (Set NontermIdent))
_hdIrulenumber :: Int
_hdIsynMap' :: (Map Identifier Attributes)
_hdIsynmap :: (Map.Map NontermIdent Attributes)
_tlIdepinfo :: ([NontDependencyInformation])
_tlIinhMap' :: (Map Identifier Attributes)
_tlIinhmap :: (Map.Map NontermIdent Attributes)
_tlIlocalSigMap :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type)))
_tlIntDeps :: (Map NontermIdent (Set NontermIdent))
_tlIntHoDeps :: (Map NontermIdent (Set NontermIdent))
_tlIrulenumber :: Int
_tlIsynMap' :: (Map Identifier Attributes)
_tlIsynmap :: (Map.Map NontermIdent Attributes)
_lhsOdepinfo =
(
_hdIdepinfo : _tlIdepinfo
)
_lhsOinhMap' =
(
_hdIinhMap' `Map.union` _tlIinhMap'
)
_lhsOinhmap =
(
_hdIinhmap `Map.union` _tlIinhmap
)
_lhsOlocalSigMap =
(
_hdIlocalSigMap `Map.union` _tlIlocalSigMap
)
_lhsOntDeps =
(
_hdIntDeps `mappend` _tlIntDeps
)
_lhsOntHoDeps =
(
_hdIntHoDeps `mappend` _tlIntHoDeps
)
_lhsOsynMap' =
(
_hdIsynMap' `Map.union` _tlIsynMap'
)
_lhsOsynmap =
(
_hdIsynmap `Map.union` _tlIsynmap
)
_lhsOrulenumber =
(
_tlIrulenumber
)
_hdOaroundMap =
(
_lhsIaroundMap
)
_hdOclassContexts =
(
_lhsIclassContexts
)
_hdOclosedHoNtDeps =
(
_lhsIclosedHoNtDeps
)
_hdOclosedHoNtRevDeps =
(
_lhsIclosedHoNtRevDeps
)
_hdOclosedNtDeps =
(
_lhsIclosedNtDeps
)
_hdOinhMap =
(
_lhsIinhMap
)
_hdOmanualDeps =
(
_lhsImanualDeps
)
_hdOmergeMap =
(
_lhsImergeMap
)
_hdOoptions =
(
_lhsIoptions
)
_hdOrulenumber =
(
_lhsIrulenumber
)
_hdOsynMap =
(
_lhsIsynMap
)
_tlOaroundMap =
(
_lhsIaroundMap
)
_tlOclassContexts =
(
_lhsIclassContexts
)
_tlOclosedHoNtDeps =
(
_lhsIclosedHoNtDeps
)
_tlOclosedHoNtRevDeps =
(
_lhsIclosedHoNtRevDeps
)
_tlOclosedNtDeps =
(
_lhsIclosedNtDeps
)
_tlOinhMap =
(
_lhsIinhMap
)
_tlOmanualDeps =
(
_lhsImanualDeps
)
_tlOmergeMap =
(
_lhsImergeMap
)
_tlOoptions =
(
_lhsIoptions
)
_tlOrulenumber =
(
_hdIrulenumber
)
_tlOsynMap =
(
_lhsIsynMap
)
( _hdIdepinfo,_hdIinhMap',_hdIinhmap,_hdIlocalSigMap,_hdIntDeps,_hdIntHoDeps,_hdIrulenumber,_hdIsynMap',_hdIsynmap) =
hd_ _hdOaroundMap _hdOclassContexts _hdOclosedHoNtDeps _hdOclosedHoNtRevDeps _hdOclosedNtDeps _hdOinhMap _hdOmanualDeps _hdOmergeMap _hdOoptions _hdOrulenumber _hdOsynMap
( _tlIdepinfo,_tlIinhMap',_tlIinhmap,_tlIlocalSigMap,_tlIntDeps,_tlIntHoDeps,_tlIrulenumber,_tlIsynMap',_tlIsynmap) =
tl_ _tlOaroundMap _tlOclassContexts _tlOclosedHoNtDeps _tlOclosedHoNtRevDeps _tlOclosedNtDeps _tlOinhMap _tlOmanualDeps _tlOmergeMap _tlOoptions _tlOrulenumber _tlOsynMap
___node =
(Syn_Nonterminals _lhsOdepinfo _lhsOinhMap' _lhsOinhmap _lhsOlocalSigMap _lhsOntDeps _lhsOntHoDeps _lhsOrulenumber _lhsOsynMap' _lhsOsynmap)
in ( _lhsOdepinfo,_lhsOinhMap',_lhsOinhmap,_lhsOlocalSigMap,_lhsOntDeps,_lhsOntHoDeps,_lhsOrulenumber,_lhsOsynMap',_lhsOsynmap))))
sem_Nonterminals_Nil :: T_Nonterminals
sem_Nonterminals_Nil =
(T_Nonterminals (\ _lhsIaroundMap
_lhsIclassContexts
_lhsIclosedHoNtDeps
_lhsIclosedHoNtRevDeps
_lhsIclosedNtDeps
_lhsIinhMap
_lhsImanualDeps
_lhsImergeMap
_lhsIoptions
_lhsIrulenumber
_lhsIsynMap ->
(let _lhsOdepinfo :: ([NontDependencyInformation])
_lhsOinhMap' :: (Map Identifier Attributes)
_lhsOinhmap :: (Map.Map NontermIdent Attributes)
_lhsOlocalSigMap :: (Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type)))
_lhsOntDeps :: (Map NontermIdent (Set NontermIdent))
_lhsOntHoDeps :: (Map NontermIdent (Set NontermIdent))
_lhsOsynMap' :: (Map Identifier Attributes)
_lhsOsynmap :: (Map.Map NontermIdent Attributes)
_lhsOrulenumber :: Int
_lhsOdepinfo =
(
[]
)
_lhsOinhMap' =
(
Map.empty
)
_lhsOinhmap =
(
Map.empty
)
_lhsOlocalSigMap =
(
Map.empty
)
_lhsOntDeps =
(
mempty
)
_lhsOntHoDeps =
(
mempty
)
_lhsOsynMap' =
(
Map.empty
)
_lhsOsynmap =
(
Map.empty
)
_lhsOrulenumber =
(
_lhsIrulenumber
)
___node =
(Syn_Nonterminals _lhsOdepinfo _lhsOinhMap' _lhsOinhmap _lhsOlocalSigMap _lhsOntDeps _lhsOntHoDeps _lhsOrulenumber _lhsOsynMap' _lhsOsynmap)
in ( _lhsOdepinfo,_lhsOinhMap',_lhsOinhmap,_lhsOlocalSigMap,_lhsOntDeps,_lhsOntHoDeps,_lhsOrulenumber,_lhsOsynMap',_lhsOsynmap))))
sem_Pattern :: Pattern ->
T_Pattern
sem_Pattern (Alias _field _attr _pat) =
(sem_Pattern_Alias _field _attr (sem_Pattern _pat))
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)
newtype T_Pattern = T_Pattern (( Pattern,(Set.Set Vertex)))
data Inh_Pattern = Inh_Pattern {}
data Syn_Pattern = Syn_Pattern {copy_Syn_Pattern :: Pattern,vertices_Syn_Pattern :: (Set.Set Vertex)}
wrap_Pattern :: T_Pattern ->
Inh_Pattern ->
Syn_Pattern
wrap_Pattern (T_Pattern sem) (Inh_Pattern) =
(let ( _lhsOcopy,_lhsOvertices) = sem
in (Syn_Pattern _lhsOcopy _lhsOvertices))
sem_Pattern_Alias :: Identifier ->
Identifier ->
T_Pattern ->
T_Pattern
sem_Pattern_Alias field_ attr_ (T_Pattern pat_) =
(T_Pattern (let _lhsOvertices :: (Set.Set Vertex)
_lhsOcopy :: Pattern
_patIcopy :: Pattern
_patIvertices :: (Set.Set Vertex)
_vertex =
(
if field_ == _INST then VChild attr_
else VAttr (if field_ == _LHS then Syn
else if field_ == _LOC then Loc
else Inh) field_ attr_
)
_lhsOvertices =
(
Set.insert _vertex _patIvertices
)
_copy =
(
Alias field_ attr_ _patIcopy
)
_lhsOcopy =
(
_copy
)
( _patIcopy,_patIvertices) =
pat_
___node =
(Syn_Pattern _lhsOcopy _lhsOvertices)
in ( _lhsOcopy,_lhsOvertices)))
sem_Pattern_Constr :: ConstructorIdent ->
T_Patterns ->
T_Pattern
sem_Pattern_Constr name_ (T_Patterns pats_) =
(T_Pattern (let _lhsOvertices :: (Set.Set Vertex)
_lhsOcopy :: Pattern
_patsIcopy :: Patterns
_patsIvertices :: (Set.Set Vertex)
_lhsOvertices =
(
_patsIvertices
)
_copy =
(
Constr name_ _patsIcopy
)
_lhsOcopy =
(
_copy
)
( _patsIcopy,_patsIvertices) =
pats_
___node =
(Syn_Pattern _lhsOcopy _lhsOvertices)
in ( _lhsOcopy,_lhsOvertices)))
sem_Pattern_Irrefutable :: T_Pattern ->
T_Pattern
sem_Pattern_Irrefutable (T_Pattern pat_) =
(T_Pattern (let _lhsOvertices :: (Set.Set Vertex)
_lhsOcopy :: Pattern
_patIcopy :: Pattern
_patIvertices :: (Set.Set Vertex)
_lhsOvertices =
(
_patIvertices
)
_copy =
(
Irrefutable _patIcopy
)
_lhsOcopy =
(
_copy
)
( _patIcopy,_patIvertices) =
pat_
___node =
(Syn_Pattern _lhsOcopy _lhsOvertices)
in ( _lhsOcopy,_lhsOvertices)))
sem_Pattern_Product :: Pos ->
T_Patterns ->
T_Pattern
sem_Pattern_Product pos_ (T_Patterns pats_) =
(T_Pattern (let _lhsOvertices :: (Set.Set Vertex)
_lhsOcopy :: Pattern
_patsIcopy :: Patterns
_patsIvertices :: (Set.Set Vertex)
_lhsOvertices =
(
_patsIvertices
)
_copy =
(
Product pos_ _patsIcopy
)
_lhsOcopy =
(
_copy
)
( _patsIcopy,_patsIvertices) =
pats_
___node =
(Syn_Pattern _lhsOcopy _lhsOvertices)
in ( _lhsOcopy,_lhsOvertices)))
sem_Pattern_Underscore :: Pos ->
T_Pattern
sem_Pattern_Underscore pos_ =
(T_Pattern (let _lhsOvertices :: (Set.Set Vertex)
_lhsOcopy :: Pattern
_lhsOvertices =
(
Set.empty
)
_copy =
(
Underscore pos_
)
_lhsOcopy =
(
_copy
)
___node =
(Syn_Pattern _lhsOcopy _lhsOvertices)
in ( _lhsOcopy,_lhsOvertices)))
sem_Patterns :: Patterns ->
T_Patterns
sem_Patterns list =
(Prelude.foldr sem_Patterns_Cons sem_Patterns_Nil (Prelude.map sem_Pattern list))
newtype T_Patterns = T_Patterns (( Patterns,(Set.Set Vertex)))
data Inh_Patterns = Inh_Patterns {}
data Syn_Patterns = Syn_Patterns {copy_Syn_Patterns :: Patterns,vertices_Syn_Patterns :: (Set.Set Vertex)}
wrap_Patterns :: T_Patterns ->
Inh_Patterns ->
Syn_Patterns
wrap_Patterns (T_Patterns sem) (Inh_Patterns) =
(let ( _lhsOcopy,_lhsOvertices) = sem
in (Syn_Patterns _lhsOcopy _lhsOvertices))
sem_Patterns_Cons :: T_Pattern ->
T_Patterns ->
T_Patterns
sem_Patterns_Cons (T_Pattern hd_) (T_Patterns tl_) =
(T_Patterns (let _lhsOvertices :: (Set.Set Vertex)
_lhsOcopy :: Patterns
_hdIcopy :: Pattern
_hdIvertices :: (Set.Set Vertex)
_tlIcopy :: Patterns
_tlIvertices :: (Set.Set Vertex)
_lhsOvertices =
(
_hdIvertices `Set.union` _tlIvertices
)
_copy =
(
(:) _hdIcopy _tlIcopy
)
_lhsOcopy =
(
_copy
)
( _hdIcopy,_hdIvertices) =
hd_
( _tlIcopy,_tlIvertices) =
tl_
___node =
(Syn_Patterns _lhsOcopy _lhsOvertices)
in ( _lhsOcopy,_lhsOvertices)))
sem_Patterns_Nil :: T_Patterns
sem_Patterns_Nil =
(T_Patterns (let _lhsOvertices :: (Set.Set Vertex)
_lhsOcopy :: Patterns
_lhsOvertices =
(
Set.empty
)
_copy =
(
[]
)
_lhsOcopy =
(
_copy
)
___node =
(Syn_Patterns _lhsOcopy _lhsOvertices)
in ( _lhsOcopy,_lhsOvertices)))
sem_Production :: Production ->
T_Production
sem_Production (Production _con _params _constraints _children _rules _typeSigs _macro) =
(sem_Production_Production _con _params _constraints (sem_Children _children) (sem_Rules _rules) (sem_TypeSigs _typeSigs) _macro)
newtype T_Production = T_Production ((Map ConstructorIdent (Map Identifier [Expression])) ->
(Map Identifier Attributes) ->
(Map ConstructorIdent (Set Dependency)) ->
(Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))) ->
Options ->
Int ->
(Map Identifier Attributes) ->
( ProdDependencyGraph,(Map.Map ConstructorIdent (Map.Map Identifier Type)),(Set NontermIdent),(Set NontermIdent),Int))
data Inh_Production = Inh_Production {aroundMap_Inh_Production :: (Map ConstructorIdent (Map Identifier [Expression])),inhMap_Inh_Production :: (Map Identifier Attributes),manualDeps_Inh_Production :: (Map ConstructorIdent (Set Dependency)),mergeMap_Inh_Production :: (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))),options_Inh_Production :: Options,rulenumber_Inh_Production :: Int,synMap_Inh_Production :: (Map Identifier Attributes)}
data Syn_Production = Syn_Production {depgraph_Syn_Production :: ProdDependencyGraph,localSigMap_Syn_Production :: (Map.Map ConstructorIdent (Map.Map Identifier Type)),refHoNts_Syn_Production :: (Set NontermIdent),refNts_Syn_Production :: (Set NontermIdent),rulenumber_Syn_Production :: Int}
wrap_Production :: T_Production ->
Inh_Production ->
Syn_Production
wrap_Production (T_Production sem) (Inh_Production _lhsIaroundMap _lhsIinhMap _lhsImanualDeps _lhsImergeMap _lhsIoptions _lhsIrulenumber _lhsIsynMap) =
(let ( _lhsOdepgraph,_lhsOlocalSigMap,_lhsOrefHoNts,_lhsOrefNts,_lhsOrulenumber) = sem _lhsIaroundMap _lhsIinhMap _lhsImanualDeps _lhsImergeMap _lhsIoptions _lhsIrulenumber _lhsIsynMap
in (Syn_Production _lhsOdepgraph _lhsOlocalSigMap _lhsOrefHoNts _lhsOrefNts _lhsOrulenumber))
sem_Production_Production :: ConstructorIdent ->
([Identifier]) ->
([Type]) ->
T_Children ->
T_Rules ->
T_TypeSigs ->
MaybeMacro ->
T_Production
sem_Production_Production con_ params_ constraints_ (T_Children children_) (T_Rules rules_) (T_TypeSigs typeSigs_) macro_ =
(T_Production (\ _lhsIaroundMap
_lhsIinhMap
_lhsImanualDeps
_lhsImergeMap
_lhsIoptions
_lhsIrulenumber
_lhsIsynMap ->
(let _lhsOdepgraph :: ProdDependencyGraph
_lhsOlocalSigMap :: (Map.Map ConstructorIdent (Map.Map Identifier Type))
_lhsOrefHoNts :: (Set NontermIdent)
_lhsOrefNts :: (Set NontermIdent)
_lhsOrulenumber :: Int
_childrenOaroundMap :: (Map Identifier [Expression])
_childrenOinhMap :: (Map Identifier Attributes)
_childrenOmergeMap :: (Map Identifier (Identifier, [Identifier], Expression))
_childrenOmergedChildren :: (Set Identifier)
_childrenOoptions :: Options
_childrenOsynMap :: (Map Identifier Attributes)
_rulesOrulenumber :: Int
_childrenIechilds :: EChildren
_childrenIedges :: (Set.Set Edge)
_childrenInontnames :: ([(Identifier, Identifier)])
_childrenIrefHoNts :: (Set NontermIdent)
_childrenIrefNts :: (Set NontermIdent)
_childrenIvertices :: (Set.Set Vertex)
_rulesIedges :: (Set.Set Edge)
_rulesIerules :: ERules
_rulesIrulenumber :: Int
_rulesIvertices :: (Set.Set Vertex)
_typeSigsIlocalSigMap :: (Map Identifier Type)
_aroundMap =
(
Map.findWithDefault Map.empty con_ _lhsIaroundMap
)
_mergeMap =
(
Map.findWithDefault Map.empty con_ _lhsImergeMap
)
_mergedChildren =
(
Set.unions [ Set.fromList ms | (_,ms,_) <- Map.elems _mergeMap ]
)
_vertices =
(
_rulesIvertices `Set.union` _childrenIvertices
)
_manualDeps =
(
Map.findWithDefault Set.empty con_ _lhsImanualDeps
)
_manualEdges =
(
Set.map depToEdge _manualDeps
)
_edges =
(
_rulesIedges `Set.union` _childrenIedges
)
_lhsOdepgraph =
(
ProdDependencyGraph { pdgVertices = Set.toList _vertices
, pdgEdges = Set.toList _edges
, pdgRules = _rulesIerules
, pdgChilds = _childrenIechilds
, pdgProduction = con_
, pdgChildMap = _childrenInontnames
, pdgConstraints = constraints_
, pdgParams = params_ }
)
_lhsOlocalSigMap =
(
Map.singleton con_ _typeSigsIlocalSigMap
)
_lhsOrefHoNts =
(
_childrenIrefHoNts
)
_lhsOrefNts =
(
_childrenIrefNts
)
_lhsOrulenumber =
(
_rulesIrulenumber
)
_childrenOaroundMap =
(
_aroundMap
)
_childrenOinhMap =
(
_lhsIinhMap
)
_childrenOmergeMap =
(
_mergeMap
)
_childrenOmergedChildren =
(
_mergedChildren
)
_childrenOoptions =
(
_lhsIoptions
)
_childrenOsynMap =
(
_lhsIsynMap
)
_rulesOrulenumber =
(
_lhsIrulenumber
)
( _childrenIechilds,_childrenIedges,_childrenInontnames,_childrenIrefHoNts,_childrenIrefNts,_childrenIvertices) =
children_ _childrenOaroundMap _childrenOinhMap _childrenOmergeMap _childrenOmergedChildren _childrenOoptions _childrenOsynMap
( _rulesIedges,_rulesIerules,_rulesIrulenumber,_rulesIvertices) =
rules_ _rulesOrulenumber
( _typeSigsIlocalSigMap) =
typeSigs_
___node =
(Syn_Production _lhsOdepgraph _lhsOlocalSigMap _lhsOrefHoNts _lhsOrefNts _lhsOrulenumber)
in ( _lhsOdepgraph,_lhsOlocalSigMap,_lhsOrefHoNts,_lhsOrefNts,_lhsOrulenumber))))
sem_Productions :: Productions ->
T_Productions
sem_Productions list =
(Prelude.foldr sem_Productions_Cons sem_Productions_Nil (Prelude.map sem_Production list))
newtype T_Productions = T_Productions ((Map ConstructorIdent (Map Identifier [Expression])) ->
(Map Identifier Attributes) ->
(Map ConstructorIdent (Set Dependency)) ->
(Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))) ->
Options ->
Int ->
(Map Identifier Attributes) ->
( ([ProdDependencyGraph]),(Map.Map ConstructorIdent (Map.Map Identifier Type)),(Set NontermIdent),(Set NontermIdent),Int))
data Inh_Productions = Inh_Productions {aroundMap_Inh_Productions :: (Map ConstructorIdent (Map Identifier [Expression])),inhMap_Inh_Productions :: (Map Identifier Attributes),manualDeps_Inh_Productions :: (Map ConstructorIdent (Set Dependency)),mergeMap_Inh_Productions :: (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))),options_Inh_Productions :: Options,rulenumber_Inh_Productions :: Int,synMap_Inh_Productions :: (Map Identifier Attributes)}
data Syn_Productions = Syn_Productions {depgraph_Syn_Productions :: ([ProdDependencyGraph]),localSigMap_Syn_Productions :: (Map.Map ConstructorIdent (Map.Map Identifier Type)),refHoNts_Syn_Productions :: (Set NontermIdent),refNts_Syn_Productions :: (Set NontermIdent),rulenumber_Syn_Productions :: Int}
wrap_Productions :: T_Productions ->
Inh_Productions ->
Syn_Productions
wrap_Productions (T_Productions sem) (Inh_Productions _lhsIaroundMap _lhsIinhMap _lhsImanualDeps _lhsImergeMap _lhsIoptions _lhsIrulenumber _lhsIsynMap) =
(let ( _lhsOdepgraph,_lhsOlocalSigMap,_lhsOrefHoNts,_lhsOrefNts,_lhsOrulenumber) = sem _lhsIaroundMap _lhsIinhMap _lhsImanualDeps _lhsImergeMap _lhsIoptions _lhsIrulenumber _lhsIsynMap
in (Syn_Productions _lhsOdepgraph _lhsOlocalSigMap _lhsOrefHoNts _lhsOrefNts _lhsOrulenumber))
sem_Productions_Cons :: T_Production ->
T_Productions ->
T_Productions
sem_Productions_Cons (T_Production hd_) (T_Productions tl_) =
(T_Productions (\ _lhsIaroundMap
_lhsIinhMap
_lhsImanualDeps
_lhsImergeMap
_lhsIoptions
_lhsIrulenumber
_lhsIsynMap ->
(let _lhsOdepgraph :: ([ProdDependencyGraph])
_lhsOlocalSigMap :: (Map.Map ConstructorIdent (Map.Map Identifier Type))
_lhsOrefHoNts :: (Set NontermIdent)
_lhsOrefNts :: (Set NontermIdent)
_lhsOrulenumber :: Int
_hdOaroundMap :: (Map ConstructorIdent (Map Identifier [Expression]))
_hdOinhMap :: (Map Identifier Attributes)
_hdOmanualDeps :: (Map ConstructorIdent (Set Dependency))
_hdOmergeMap :: (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))
_hdOoptions :: Options
_hdOrulenumber :: Int
_hdOsynMap :: (Map Identifier Attributes)
_tlOaroundMap :: (Map ConstructorIdent (Map Identifier [Expression]))
_tlOinhMap :: (Map Identifier Attributes)
_tlOmanualDeps :: (Map ConstructorIdent (Set Dependency))
_tlOmergeMap :: (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))
_tlOoptions :: Options
_tlOrulenumber :: Int
_tlOsynMap :: (Map Identifier Attributes)
_hdIdepgraph :: ProdDependencyGraph
_hdIlocalSigMap :: (Map.Map ConstructorIdent (Map.Map Identifier Type))
_hdIrefHoNts :: (Set NontermIdent)
_hdIrefNts :: (Set NontermIdent)
_hdIrulenumber :: Int
_tlIdepgraph :: ([ProdDependencyGraph])
_tlIlocalSigMap :: (Map.Map ConstructorIdent (Map.Map Identifier Type))
_tlIrefHoNts :: (Set NontermIdent)
_tlIrefNts :: (Set NontermIdent)
_tlIrulenumber :: Int
_lhsOdepgraph =
(
_hdIdepgraph : _tlIdepgraph
)
_lhsOlocalSigMap =
(
_hdIlocalSigMap `Map.union` _tlIlocalSigMap
)
_lhsOrefHoNts =
(
_hdIrefHoNts `mappend` _tlIrefHoNts
)
_lhsOrefNts =
(
_hdIrefNts `mappend` _tlIrefNts
)
_lhsOrulenumber =
(
_tlIrulenumber
)
_hdOaroundMap =
(
_lhsIaroundMap
)
_hdOinhMap =
(
_lhsIinhMap
)
_hdOmanualDeps =
(
_lhsImanualDeps
)
_hdOmergeMap =
(
_lhsImergeMap
)
_hdOoptions =
(
_lhsIoptions
)
_hdOrulenumber =
(
_lhsIrulenumber
)
_hdOsynMap =
(
_lhsIsynMap
)
_tlOaroundMap =
(
_lhsIaroundMap
)
_tlOinhMap =
(
_lhsIinhMap
)
_tlOmanualDeps =
(
_lhsImanualDeps
)
_tlOmergeMap =
(
_lhsImergeMap
)
_tlOoptions =
(
_lhsIoptions
)
_tlOrulenumber =
(
_hdIrulenumber
)
_tlOsynMap =
(
_lhsIsynMap
)
( _hdIdepgraph,_hdIlocalSigMap,_hdIrefHoNts,_hdIrefNts,_hdIrulenumber) =
hd_ _hdOaroundMap _hdOinhMap _hdOmanualDeps _hdOmergeMap _hdOoptions _hdOrulenumber _hdOsynMap
( _tlIdepgraph,_tlIlocalSigMap,_tlIrefHoNts,_tlIrefNts,_tlIrulenumber) =
tl_ _tlOaroundMap _tlOinhMap _tlOmanualDeps _tlOmergeMap _tlOoptions _tlOrulenumber _tlOsynMap
___node =
(Syn_Productions _lhsOdepgraph _lhsOlocalSigMap _lhsOrefHoNts _lhsOrefNts _lhsOrulenumber)
in ( _lhsOdepgraph,_lhsOlocalSigMap,_lhsOrefHoNts,_lhsOrefNts,_lhsOrulenumber))))
sem_Productions_Nil :: T_Productions
sem_Productions_Nil =
(T_Productions (\ _lhsIaroundMap
_lhsIinhMap
_lhsImanualDeps
_lhsImergeMap
_lhsIoptions
_lhsIrulenumber
_lhsIsynMap ->
(let _lhsOdepgraph :: ([ProdDependencyGraph])
_lhsOlocalSigMap :: (Map.Map ConstructorIdent (Map.Map Identifier Type))
_lhsOrefHoNts :: (Set NontermIdent)
_lhsOrefNts :: (Set NontermIdent)
_lhsOrulenumber :: Int
_lhsOdepgraph =
(
[]
)
_lhsOlocalSigMap =
(
Map.empty
)
_lhsOrefHoNts =
(
mempty
)
_lhsOrefNts =
(
mempty
)
_lhsOrulenumber =
(
_lhsIrulenumber
)
___node =
(Syn_Productions _lhsOdepgraph _lhsOlocalSigMap _lhsOrefHoNts _lhsOrefNts _lhsOrulenumber)
in ( _lhsOdepgraph,_lhsOlocalSigMap,_lhsOrefHoNts,_lhsOrefNts,_lhsOrulenumber))))
sem_Rule :: Rule ->
T_Rule
sem_Rule (Rule _mbName _pattern _rhs _owrt _origin _explicit _pure _identity _mbError _eager) =
(sem_Rule_Rule _mbName (sem_Pattern _pattern) (sem_Expression _rhs) _owrt _origin _explicit _pure _identity _mbError _eager)
newtype T_Rule = T_Rule (Int ->
( (Set.Set Edge),ERule,Int,(Set.Set Vertex)))
data Inh_Rule = Inh_Rule {rulenumber_Inh_Rule :: Int}
data Syn_Rule = Syn_Rule {edges_Syn_Rule :: (Set.Set Edge),erules_Syn_Rule :: ERule,rulenumber_Syn_Rule :: Int,vertices_Syn_Rule :: (Set.Set Vertex)}
wrap_Rule :: T_Rule ->
Inh_Rule ->
Syn_Rule
wrap_Rule (T_Rule sem) (Inh_Rule _lhsIrulenumber) =
(let ( _lhsOedges,_lhsOerules,_lhsOrulenumber,_lhsOvertices) = sem _lhsIrulenumber
in (Syn_Rule _lhsOedges _lhsOerules _lhsOrulenumber _lhsOvertices))
sem_Rule_Rule :: (Maybe Identifier) ->
T_Pattern ->
T_Expression ->
Bool ->
String ->
Bool ->
Bool ->
Bool ->
(Maybe Error) ->
Bool ->
T_Rule
sem_Rule_Rule mbName_ (T_Pattern pattern_) (T_Expression rhs_) owrt_ origin_ explicit_ pure_ identity_ mbError_ eager_ =
(T_Rule (\ _lhsIrulenumber ->
(let _lhsOrulenumber :: Int
_lhsOerules :: ERule
_lhsOvertices :: (Set.Set Vertex)
_lhsOedges :: (Set.Set Edge)
_patternIcopy :: Pattern
_patternIvertices :: (Set.Set Vertex)
_rhsIcopy :: Expression
_rhsIvertices :: (Set.Set Vertex)
_lhsOrulenumber =
(
_lhsIrulenumber + 1
)
_rulename =
(
maybe (identifier $ "rule" ++ show _lhsIrulenumber) id mbName_
)
_lhsOerules =
(
ERule _rulename
_patternIcopy
_rhsIcopy
owrt_
origin_
explicit_
pure_
mbError_
)
_vertex =
(
VRule _rulename
)
_lhsOvertices =
(
Set.insert _vertex $ _patternIvertices `Set.union` _rhsIvertices
)
_edgesout =
(
map ((,) _vertex ) (Set.toList _rhsIvertices)
)
_edgesin =
(
map (flip (,) _vertex ) (Set.toList _patternIvertices)
)
_lhsOedges =
(
Set.fromList $ _edgesout ++ _edgesin
)
( _patternIcopy,_patternIvertices) =
pattern_
( _rhsIcopy,_rhsIvertices) =
rhs_
___node =
(Syn_Rule _lhsOedges _lhsOerules _lhsOrulenumber _lhsOvertices)
in ( _lhsOedges,_lhsOerules,_lhsOrulenumber,_lhsOvertices))))
sem_Rules :: Rules ->
T_Rules
sem_Rules list =
(Prelude.foldr sem_Rules_Cons sem_Rules_Nil (Prelude.map sem_Rule list))
newtype T_Rules = T_Rules (Int ->
( (Set.Set Edge),ERules,Int,(Set.Set Vertex)))
data Inh_Rules = Inh_Rules {rulenumber_Inh_Rules :: Int}
data Syn_Rules = Syn_Rules {edges_Syn_Rules :: (Set.Set Edge),erules_Syn_Rules :: ERules,rulenumber_Syn_Rules :: Int,vertices_Syn_Rules :: (Set.Set Vertex)}
wrap_Rules :: T_Rules ->
Inh_Rules ->
Syn_Rules
wrap_Rules (T_Rules sem) (Inh_Rules _lhsIrulenumber) =
(let ( _lhsOedges,_lhsOerules,_lhsOrulenumber,_lhsOvertices) = sem _lhsIrulenumber
in (Syn_Rules _lhsOedges _lhsOerules _lhsOrulenumber _lhsOvertices))
sem_Rules_Cons :: T_Rule ->
T_Rules ->
T_Rules
sem_Rules_Cons (T_Rule hd_) (T_Rules tl_) =
(T_Rules (\ _lhsIrulenumber ->
(let _lhsOedges :: (Set.Set Edge)
_lhsOerules :: ERules
_lhsOvertices :: (Set.Set Vertex)
_lhsOrulenumber :: Int
_hdOrulenumber :: Int
_tlOrulenumber :: Int
_hdIedges :: (Set.Set Edge)
_hdIerules :: ERule
_hdIrulenumber :: Int
_hdIvertices :: (Set.Set Vertex)
_tlIedges :: (Set.Set Edge)
_tlIerules :: ERules
_tlIrulenumber :: Int
_tlIvertices :: (Set.Set Vertex)
_lhsOedges =
(
_hdIedges `Set.union` _tlIedges
)
_lhsOerules =
(
_hdIerules : _tlIerules
)
_lhsOvertices =
(
_hdIvertices `Set.union` _tlIvertices
)
_lhsOrulenumber =
(
_tlIrulenumber
)
_hdOrulenumber =
(
_lhsIrulenumber
)
_tlOrulenumber =
(
_hdIrulenumber
)
( _hdIedges,_hdIerules,_hdIrulenumber,_hdIvertices) =
hd_ _hdOrulenumber
( _tlIedges,_tlIerules,_tlIrulenumber,_tlIvertices) =
tl_ _tlOrulenumber
___node =
(Syn_Rules _lhsOedges _lhsOerules _lhsOrulenumber _lhsOvertices)
in ( _lhsOedges,_lhsOerules,_lhsOrulenumber,_lhsOvertices))))
sem_Rules_Nil :: T_Rules
sem_Rules_Nil =
(T_Rules (\ _lhsIrulenumber ->
(let _lhsOedges :: (Set.Set Edge)
_lhsOerules :: ERules
_lhsOvertices :: (Set.Set Vertex)
_lhsOrulenumber :: Int
_lhsOedges =
(
Set.empty
)
_lhsOerules =
(
[]
)
_lhsOvertices =
(
Set.empty
)
_lhsOrulenumber =
(
_lhsIrulenumber
)
___node =
(Syn_Rules _lhsOedges _lhsOerules _lhsOrulenumber _lhsOvertices)
in ( _lhsOedges,_lhsOerules,_lhsOrulenumber,_lhsOvertices))))
sem_TypeSig :: TypeSig ->
T_TypeSig
sem_TypeSig (TypeSig _name _tp) =
(sem_TypeSig_TypeSig _name _tp)
newtype T_TypeSig = T_TypeSig (( (Map Identifier Type)))
data Inh_TypeSig = Inh_TypeSig {}
data Syn_TypeSig = Syn_TypeSig {localSigMap_Syn_TypeSig :: (Map Identifier Type)}
wrap_TypeSig :: T_TypeSig ->
Inh_TypeSig ->
Syn_TypeSig
wrap_TypeSig (T_TypeSig sem) (Inh_TypeSig) =
(let ( _lhsOlocalSigMap) = sem
in (Syn_TypeSig _lhsOlocalSigMap))
sem_TypeSig_TypeSig :: Identifier ->
Type ->
T_TypeSig
sem_TypeSig_TypeSig name_ tp_ =
(T_TypeSig (let _lhsOlocalSigMap :: (Map Identifier Type)
_lhsOlocalSigMap =
(
Map.singleton name_ tp_
)
___node =
(Syn_TypeSig _lhsOlocalSigMap)
in ( _lhsOlocalSigMap)))
sem_TypeSigs :: TypeSigs ->
T_TypeSigs
sem_TypeSigs list =
(Prelude.foldr sem_TypeSigs_Cons sem_TypeSigs_Nil (Prelude.map sem_TypeSig list))
newtype T_TypeSigs = T_TypeSigs (( (Map Identifier Type)))
data Inh_TypeSigs = Inh_TypeSigs {}
data Syn_TypeSigs = Syn_TypeSigs {localSigMap_Syn_TypeSigs :: (Map Identifier Type)}
wrap_TypeSigs :: T_TypeSigs ->
Inh_TypeSigs ->
Syn_TypeSigs
wrap_TypeSigs (T_TypeSigs sem) (Inh_TypeSigs) =
(let ( _lhsOlocalSigMap) = sem
in (Syn_TypeSigs _lhsOlocalSigMap))
sem_TypeSigs_Cons :: T_TypeSig ->
T_TypeSigs ->
T_TypeSigs
sem_TypeSigs_Cons (T_TypeSig hd_) (T_TypeSigs tl_) =
(T_TypeSigs (let _lhsOlocalSigMap :: (Map Identifier Type)
_hdIlocalSigMap :: (Map Identifier Type)
_tlIlocalSigMap :: (Map Identifier Type)
_lhsOlocalSigMap =
(
_hdIlocalSigMap `Map.union` _tlIlocalSigMap
)
( _hdIlocalSigMap) =
hd_
( _tlIlocalSigMap) =
tl_
___node =
(Syn_TypeSigs _lhsOlocalSigMap)
in ( _lhsOlocalSigMap)))
sem_TypeSigs_Nil :: T_TypeSigs
sem_TypeSigs_Nil =
(T_TypeSigs (let _lhsOlocalSigMap :: (Map Identifier Type)
_lhsOlocalSigMap =
(
Map.empty
)
___node =
(Syn_TypeSigs _lhsOlocalSigMap)
in ( _lhsOlocalSigMap)))