module TfmToVisage where
import AbstractSyntax
import VisagePatterns
import VisageSyntax
import qualified Data.Map as Map
import Data.Map (Map)
import Data.Set(Set)
import Data.Map(Map)
import Patterns (Pattern(..),Patterns)
import Expression (Expression(..))
import Macro --marcos
import CommonTypes
import ErrorMessages
import UU.Scanner.Position(Pos)
import CommonTypes (ConstructorIdent,Identifier)
import UU.Scanner.Position(Pos)
import HsToken
isVar (Alias _ _ (Underscore _)) = True
isVar _ = False
type VisageRuleMap = [(String, VisageRule)]
splitVRules :: [VisageRule] -> VisageRuleMap
splitVRules vrs = concat (map unfoldvrs vrs)
unfoldvrs :: VisageRule -> VisageRuleMap
unfoldvrs vr@(VRule attrfields _ _ _ _) = zip (map (getName . fst) attrfields) (map (copyRule vr) attrfields)
copyRule :: VisageRule -> (Identifier,Identifier) -> VisageRule
copyRule (VRule attrfields _ pat expr owrt) (field,attr) = VRule attrfields attr pat expr owrt
getForField :: String -> VisageRuleMap -> [VisageRule]
getForField field xs = map snd (filter ((field ==) . fst) xs)
sem_Child :: Child ->
T_Child
sem_Child (Child _name _tp _kind) =
(sem_Child_Child _name _tp _kind)
newtype T_Child = T_Child ((Map Identifier Attributes) ->
VisageRuleMap ->
(Map Identifier Attributes) ->
( VisageChild))
data Inh_Child = Inh_Child {inhMap_Inh_Child :: (Map Identifier Attributes),rulemap_Inh_Child :: VisageRuleMap,synMap_Inh_Child :: (Map Identifier Attributes)}
data Syn_Child = Syn_Child {vchild_Syn_Child :: VisageChild}
wrap_Child :: T_Child ->
Inh_Child ->
Syn_Child
wrap_Child (T_Child sem) (Inh_Child _lhsIinhMap _lhsIrulemap _lhsIsynMap) =
(let ( _lhsOvchild) = sem _lhsIinhMap _lhsIrulemap _lhsIsynMap
in (Syn_Child _lhsOvchild))
sem_Child_Child :: Identifier ->
Type ->
ChildKind ->
T_Child
sem_Child_Child name_ tp_ kind_ =
(T_Child (\ _lhsIinhMap
_lhsIrulemap
_lhsIsynMap ->
(let _lhsOvchild :: VisageChild
_lhsOvchild =
(
VChild name_ tp_ _inh _syn (getForField (getName name_) _lhsIrulemap)
)
_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
)
___node =
(Syn_Child _lhsOvchild)
in ( _lhsOvchild))))
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 Attributes) ->
VisageRuleMap ->
(Map Identifier Attributes) ->
( ([VisageChild])))
data Inh_Children = Inh_Children {inhMap_Inh_Children :: (Map Identifier Attributes),rulemap_Inh_Children :: VisageRuleMap,synMap_Inh_Children :: (Map Identifier Attributes)}
data Syn_Children = Syn_Children {vchildren_Syn_Children :: ([VisageChild])}
wrap_Children :: T_Children ->
Inh_Children ->
Syn_Children
wrap_Children (T_Children sem) (Inh_Children _lhsIinhMap _lhsIrulemap _lhsIsynMap) =
(let ( _lhsOvchildren) = sem _lhsIinhMap _lhsIrulemap _lhsIsynMap
in (Syn_Children _lhsOvchildren))
sem_Children_Cons :: T_Child ->
T_Children ->
T_Children
sem_Children_Cons (T_Child hd_) (T_Children tl_) =
(T_Children (\ _lhsIinhMap
_lhsIrulemap
_lhsIsynMap ->
(let _lhsOvchildren :: ([VisageChild])
_hdOinhMap :: (Map Identifier Attributes)
_hdOrulemap :: VisageRuleMap
_hdOsynMap :: (Map Identifier Attributes)
_tlOinhMap :: (Map Identifier Attributes)
_tlOrulemap :: VisageRuleMap
_tlOsynMap :: (Map Identifier Attributes)
_hdIvchild :: VisageChild
_tlIvchildren :: ([VisageChild])
_lhsOvchildren =
(
_hdIvchild : _tlIvchildren
)
_hdOinhMap =
(
_lhsIinhMap
)
_hdOrulemap =
(
_lhsIrulemap
)
_hdOsynMap =
(
_lhsIsynMap
)
_tlOinhMap =
(
_lhsIinhMap
)
_tlOrulemap =
(
_lhsIrulemap
)
_tlOsynMap =
(
_lhsIsynMap
)
( _hdIvchild) =
hd_ _hdOinhMap _hdOrulemap _hdOsynMap
( _tlIvchildren) =
tl_ _tlOinhMap _tlOrulemap _tlOsynMap
___node =
(Syn_Children _lhsOvchildren)
in ( _lhsOvchildren))))
sem_Children_Nil :: T_Children
sem_Children_Nil =
(T_Children (\ _lhsIinhMap
_lhsIrulemap
_lhsIsynMap ->
(let _lhsOvchildren :: ([VisageChild])
_lhsOvchildren =
(
[]
)
___node =
(Syn_Children _lhsOvchildren)
in ( _lhsOvchildren))))
sem_Expression :: Expression ->
T_Expression
sem_Expression (Expression _pos _tks) =
(sem_Expression_Expression _pos _tks)
newtype T_Expression = T_Expression (( Expression))
data Inh_Expression = Inh_Expression {}
data Syn_Expression = Syn_Expression {self_Syn_Expression :: Expression}
wrap_Expression :: T_Expression ->
Inh_Expression ->
Syn_Expression
wrap_Expression (T_Expression sem) (Inh_Expression) =
(let ( _lhsOself) = sem
in (Syn_Expression _lhsOself))
sem_Expression_Expression :: Pos ->
([HsToken]) ->
T_Expression
sem_Expression_Expression pos_ tks_ =
(T_Expression (let _lhsOself :: Expression
_self =
(
Expression pos_ tks_
)
_lhsOself =
(
_self
)
___node =
(Syn_Expression _lhsOself)
in ( _lhsOself)))
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 (( VisageGrammar))
data Inh_Grammar = Inh_Grammar {}
data Syn_Grammar = Syn_Grammar {visage_Syn_Grammar :: VisageGrammar}
wrap_Grammar :: T_Grammar ->
Inh_Grammar ->
Syn_Grammar
wrap_Grammar (T_Grammar sem) (Inh_Grammar) =
(let ( _lhsOvisage) = sem
in (Syn_Grammar _lhsOvisage))
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 (let _lhsOvisage :: VisageGrammar
_nontsOinhMap :: (Map Identifier Attributes)
_nontsOsynMap :: (Map Identifier Attributes)
_nontsIinhMap' :: (Map Identifier Attributes)
_nontsIsynMap' :: (Map Identifier Attributes)
_nontsIvnonts :: ([VisageNonterminal])
_lhsOvisage =
(
VGrammar _nontsIvnonts
)
_nontsOinhMap =
(
_nontsIinhMap'
)
_nontsOsynMap =
(
_nontsIsynMap'
)
( _nontsIinhMap',_nontsIsynMap',_nontsIvnonts) =
nonts_ _nontsOinhMap _nontsOsynMap
___node =
(Syn_Grammar _lhsOvisage)
in ( _lhsOvisage)))
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 Identifier Attributes) ->
(Map Identifier Attributes) ->
( (Map Identifier Attributes),(Map Identifier Attributes),VisageNonterminal))
data Inh_Nonterminal = Inh_Nonterminal {inhMap_Inh_Nonterminal :: (Map Identifier Attributes),synMap_Inh_Nonterminal :: (Map Identifier Attributes)}
data Syn_Nonterminal = Syn_Nonterminal {inhMap'_Syn_Nonterminal :: (Map Identifier Attributes),synMap'_Syn_Nonterminal :: (Map Identifier Attributes),vnont_Syn_Nonterminal :: VisageNonterminal}
wrap_Nonterminal :: T_Nonterminal ->
Inh_Nonterminal ->
Syn_Nonterminal
wrap_Nonterminal (T_Nonterminal sem) (Inh_Nonterminal _lhsIinhMap _lhsIsynMap) =
(let ( _lhsOinhMap',_lhsOsynMap',_lhsOvnont) = sem _lhsIinhMap _lhsIsynMap
in (Syn_Nonterminal _lhsOinhMap' _lhsOsynMap' _lhsOvnont))
sem_Nonterminal_Nonterminal :: NontermIdent ->
([Identifier]) ->
Attributes ->
Attributes ->
T_Productions ->
T_Nonterminal
sem_Nonterminal_Nonterminal nt_ params_ inh_ syn_ (T_Productions prods_) =
(T_Nonterminal (\ _lhsIinhMap
_lhsIsynMap ->
(let _lhsOvnont :: VisageNonterminal
_lhsOinhMap' :: (Map Identifier Attributes)
_lhsOsynMap' :: (Map Identifier Attributes)
_prodsOinhMap :: (Map Identifier Attributes)
_prodsOsynMap :: (Map Identifier Attributes)
_prodsIvprods :: ([VisageProduction])
_lhsOvnont =
(
VNonterminal nt_ inh_ syn_ _prodsIvprods
)
_lhsOinhMap' =
(
Map.singleton nt_ inh_
)
_lhsOsynMap' =
(
Map.singleton nt_ syn_
)
_prodsOinhMap =
(
_lhsIinhMap
)
_prodsOsynMap =
(
_lhsIsynMap
)
( _prodsIvprods) =
prods_ _prodsOinhMap _prodsOsynMap
___node =
(Syn_Nonterminal _lhsOinhMap' _lhsOsynMap' _lhsOvnont)
in ( _lhsOinhMap',_lhsOsynMap',_lhsOvnont))))
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 Identifier Attributes) ->
(Map Identifier Attributes) ->
( (Map Identifier Attributes),(Map Identifier Attributes),([VisageNonterminal])))
data Inh_Nonterminals = Inh_Nonterminals {inhMap_Inh_Nonterminals :: (Map Identifier Attributes),synMap_Inh_Nonterminals :: (Map Identifier Attributes)}
data Syn_Nonterminals = Syn_Nonterminals {inhMap'_Syn_Nonterminals :: (Map Identifier Attributes),synMap'_Syn_Nonterminals :: (Map Identifier Attributes),vnonts_Syn_Nonterminals :: ([VisageNonterminal])}
wrap_Nonterminals :: T_Nonterminals ->
Inh_Nonterminals ->
Syn_Nonterminals
wrap_Nonterminals (T_Nonterminals sem) (Inh_Nonterminals _lhsIinhMap _lhsIsynMap) =
(let ( _lhsOinhMap',_lhsOsynMap',_lhsOvnonts) = sem _lhsIinhMap _lhsIsynMap
in (Syn_Nonterminals _lhsOinhMap' _lhsOsynMap' _lhsOvnonts))
sem_Nonterminals_Cons :: T_Nonterminal ->
T_Nonterminals ->
T_Nonterminals
sem_Nonterminals_Cons (T_Nonterminal hd_) (T_Nonterminals tl_) =
(T_Nonterminals (\ _lhsIinhMap
_lhsIsynMap ->
(let _lhsOvnonts :: ([VisageNonterminal])
_lhsOinhMap' :: (Map Identifier Attributes)
_lhsOsynMap' :: (Map Identifier Attributes)
_hdOinhMap :: (Map Identifier Attributes)
_hdOsynMap :: (Map Identifier Attributes)
_tlOinhMap :: (Map Identifier Attributes)
_tlOsynMap :: (Map Identifier Attributes)
_hdIinhMap' :: (Map Identifier Attributes)
_hdIsynMap' :: (Map Identifier Attributes)
_hdIvnont :: VisageNonterminal
_tlIinhMap' :: (Map Identifier Attributes)
_tlIsynMap' :: (Map Identifier Attributes)
_tlIvnonts :: ([VisageNonterminal])
_lhsOvnonts =
(
_hdIvnont : _tlIvnonts
)
_lhsOinhMap' =
(
_hdIinhMap' `Map.union` _tlIinhMap'
)
_lhsOsynMap' =
(
_hdIsynMap' `Map.union` _tlIsynMap'
)
_hdOinhMap =
(
_lhsIinhMap
)
_hdOsynMap =
(
_lhsIsynMap
)
_tlOinhMap =
(
_lhsIinhMap
)
_tlOsynMap =
(
_lhsIsynMap
)
( _hdIinhMap',_hdIsynMap',_hdIvnont) =
hd_ _hdOinhMap _hdOsynMap
( _tlIinhMap',_tlIsynMap',_tlIvnonts) =
tl_ _tlOinhMap _tlOsynMap
___node =
(Syn_Nonterminals _lhsOinhMap' _lhsOsynMap' _lhsOvnonts)
in ( _lhsOinhMap',_lhsOsynMap',_lhsOvnonts))))
sem_Nonterminals_Nil :: T_Nonterminals
sem_Nonterminals_Nil =
(T_Nonterminals (\ _lhsIinhMap
_lhsIsynMap ->
(let _lhsOvnonts :: ([VisageNonterminal])
_lhsOinhMap' :: (Map Identifier Attributes)
_lhsOsynMap' :: (Map Identifier Attributes)
_lhsOvnonts =
(
[]
)
_lhsOinhMap' =
(
Map.empty
)
_lhsOsynMap' =
(
Map.empty
)
___node =
(Syn_Nonterminals _lhsOinhMap' _lhsOsynMap' _lhsOvnonts)
in ( _lhsOinhMap',_lhsOsynMap',_lhsOvnonts))))
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,( [(Identifier,Identifier)] ),Pattern,VisagePattern))
data Inh_Pattern = Inh_Pattern {}
data Syn_Pattern = Syn_Pattern {copy_Syn_Pattern :: Pattern,fieldattrs_Syn_Pattern :: ( [(Identifier,Identifier)] ),self_Syn_Pattern :: Pattern,vpat_Syn_Pattern :: VisagePattern}
wrap_Pattern :: T_Pattern ->
Inh_Pattern ->
Syn_Pattern
wrap_Pattern (T_Pattern sem) (Inh_Pattern) =
(let ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpat) = sem
in (Syn_Pattern _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpat))
sem_Pattern_Alias :: Identifier ->
Identifier ->
T_Pattern ->
T_Pattern
sem_Pattern_Alias field_ attr_ (T_Pattern pat_) =
(T_Pattern (let _lhsOvpat :: VisagePattern
_lhsOfieldattrs :: ( [(Identifier,Identifier)] )
_lhsOcopy :: Pattern
_lhsOself :: Pattern
_patIcopy :: Pattern
_patIfieldattrs :: ( [(Identifier,Identifier)] )
_patIself :: Pattern
_patIvpat :: VisagePattern
_lhsOvpat =
(
if (isVar _self)
then VVar field_ attr_
else VAlias field_ attr_ _patIvpat
)
_lhsOfieldattrs =
(
[(field_, attr_)]
)
_copy =
(
Alias field_ attr_ _patIcopy
)
_self =
(
Alias field_ attr_ _patIself
)
_lhsOcopy =
(
_copy
)
_lhsOself =
(
_self
)
( _patIcopy,_patIfieldattrs,_patIself,_patIvpat) =
pat_
___node =
(Syn_Pattern _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpat)
in ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpat)))
sem_Pattern_Constr :: ConstructorIdent ->
T_Patterns ->
T_Pattern
sem_Pattern_Constr name_ (T_Patterns pats_) =
(T_Pattern (let _lhsOvpat :: VisagePattern
_lhsOfieldattrs :: ( [(Identifier,Identifier)] )
_lhsOcopy :: Pattern
_lhsOself :: Pattern
_patsIcopy :: Patterns
_patsIfieldattrs :: ( [(Identifier,Identifier)] )
_patsIself :: Patterns
_patsIvpats :: ([VisagePattern])
_lhsOvpat =
(
VConstr name_ _patsIvpats
)
_lhsOfieldattrs =
(
_patsIfieldattrs
)
_copy =
(
Constr name_ _patsIcopy
)
_self =
(
Constr name_ _patsIself
)
_lhsOcopy =
(
_copy
)
_lhsOself =
(
_self
)
( _patsIcopy,_patsIfieldattrs,_patsIself,_patsIvpats) =
pats_
___node =
(Syn_Pattern _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpat)
in ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpat)))
sem_Pattern_Irrefutable :: T_Pattern ->
T_Pattern
sem_Pattern_Irrefutable (T_Pattern pat_) =
(T_Pattern (let _lhsOfieldattrs :: ( [(Identifier,Identifier)] )
_lhsOcopy :: Pattern
_lhsOself :: Pattern
_lhsOvpat :: VisagePattern
_patIcopy :: Pattern
_patIfieldattrs :: ( [(Identifier,Identifier)] )
_patIself :: Pattern
_patIvpat :: VisagePattern
_lhsOfieldattrs =
(
_patIfieldattrs
)
_copy =
(
Irrefutable _patIcopy
)
_self =
(
Irrefutable _patIself
)
_lhsOcopy =
(
_copy
)
_lhsOself =
(
_self
)
_lhsOvpat =
(
_patIvpat
)
( _patIcopy,_patIfieldattrs,_patIself,_patIvpat) =
pat_
___node =
(Syn_Pattern _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpat)
in ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpat)))
sem_Pattern_Product :: Pos ->
T_Patterns ->
T_Pattern
sem_Pattern_Product pos_ (T_Patterns pats_) =
(T_Pattern (let _lhsOvpat :: VisagePattern
_lhsOfieldattrs :: ( [(Identifier,Identifier)] )
_lhsOcopy :: Pattern
_lhsOself :: Pattern
_patsIcopy :: Patterns
_patsIfieldattrs :: ( [(Identifier,Identifier)] )
_patsIself :: Patterns
_patsIvpats :: ([VisagePattern])
_lhsOvpat =
(
VProduct pos_ _patsIvpats
)
_lhsOfieldattrs =
(
_patsIfieldattrs
)
_copy =
(
Product pos_ _patsIcopy
)
_self =
(
Product pos_ _patsIself
)
_lhsOcopy =
(
_copy
)
_lhsOself =
(
_self
)
( _patsIcopy,_patsIfieldattrs,_patsIself,_patsIvpats) =
pats_
___node =
(Syn_Pattern _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpat)
in ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpat)))
sem_Pattern_Underscore :: Pos ->
T_Pattern
sem_Pattern_Underscore pos_ =
(T_Pattern (let _lhsOvpat :: VisagePattern
_lhsOfieldattrs :: ( [(Identifier,Identifier)] )
_lhsOcopy :: Pattern
_lhsOself :: Pattern
_lhsOvpat =
(
VUnderscore pos_
)
_lhsOfieldattrs =
(
[]
)
_copy =
(
Underscore pos_
)
_self =
(
Underscore pos_
)
_lhsOcopy =
(
_copy
)
_lhsOself =
(
_self
)
___node =
(Syn_Pattern _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpat)
in ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpat)))
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,( [(Identifier,Identifier)] ),Patterns,([VisagePattern])))
data Inh_Patterns = Inh_Patterns {}
data Syn_Patterns = Syn_Patterns {copy_Syn_Patterns :: Patterns,fieldattrs_Syn_Patterns :: ( [(Identifier,Identifier)] ),self_Syn_Patterns :: Patterns,vpats_Syn_Patterns :: ([VisagePattern])}
wrap_Patterns :: T_Patterns ->
Inh_Patterns ->
Syn_Patterns
wrap_Patterns (T_Patterns sem) (Inh_Patterns) =
(let ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpats) = sem
in (Syn_Patterns _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpats))
sem_Patterns_Cons :: T_Pattern ->
T_Patterns ->
T_Patterns
sem_Patterns_Cons (T_Pattern hd_) (T_Patterns tl_) =
(T_Patterns (let _lhsOvpats :: ([VisagePattern])
_lhsOfieldattrs :: ( [(Identifier,Identifier)] )
_lhsOcopy :: Patterns
_lhsOself :: Patterns
_hdIcopy :: Pattern
_hdIfieldattrs :: ( [(Identifier,Identifier)] )
_hdIself :: Pattern
_hdIvpat :: VisagePattern
_tlIcopy :: Patterns
_tlIfieldattrs :: ( [(Identifier,Identifier)] )
_tlIself :: Patterns
_tlIvpats :: ([VisagePattern])
_lhsOvpats =
(
_hdIvpat : _tlIvpats
)
_lhsOfieldattrs =
(
_hdIfieldattrs ++ _tlIfieldattrs
)
_copy =
(
(:) _hdIcopy _tlIcopy
)
_self =
(
(:) _hdIself _tlIself
)
_lhsOcopy =
(
_copy
)
_lhsOself =
(
_self
)
( _hdIcopy,_hdIfieldattrs,_hdIself,_hdIvpat) =
hd_
( _tlIcopy,_tlIfieldattrs,_tlIself,_tlIvpats) =
tl_
___node =
(Syn_Patterns _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpats)
in ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpats)))
sem_Patterns_Nil :: T_Patterns
sem_Patterns_Nil =
(T_Patterns (let _lhsOvpats :: ([VisagePattern])
_lhsOfieldattrs :: ( [(Identifier,Identifier)] )
_lhsOcopy :: Patterns
_lhsOself :: Patterns
_lhsOvpats =
(
[]
)
_lhsOfieldattrs =
(
[]
)
_copy =
(
[]
)
_self =
(
[]
)
_lhsOcopy =
(
_copy
)
_lhsOself =
(
_self
)
___node =
(Syn_Patterns _lhsOcopy _lhsOfieldattrs _lhsOself _lhsOvpats)
in ( _lhsOcopy,_lhsOfieldattrs,_lhsOself,_lhsOvpats)))
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 Identifier Attributes) ->
(Map Identifier Attributes) ->
( VisageProduction))
data Inh_Production = Inh_Production {inhMap_Inh_Production :: (Map Identifier Attributes),synMap_Inh_Production :: (Map Identifier Attributes)}
data Syn_Production = Syn_Production {vprod_Syn_Production :: VisageProduction}
wrap_Production :: T_Production ->
Inh_Production ->
Syn_Production
wrap_Production (T_Production sem) (Inh_Production _lhsIinhMap _lhsIsynMap) =
(let ( _lhsOvprod) = sem _lhsIinhMap _lhsIsynMap
in (Syn_Production _lhsOvprod))
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 (\ _lhsIinhMap
_lhsIsynMap ->
(let _lhsOvprod :: VisageProduction
_childrenOrulemap :: VisageRuleMap
_childrenOinhMap :: (Map Identifier Attributes)
_childrenOsynMap :: (Map Identifier Attributes)
_childrenIvchildren :: ([VisageChild])
_rulesIvrules :: ([VisageRule])
_lhsOvprod =
(
VProduction con_ _childrenIvchildren _lhsrules _locrules
)
_splitVRules =
(
splitVRules _rulesIvrules
)
_locrules =
(
getForField "loc" _splitVRules
)
_lhsrules =
(
getForField "lhs" _splitVRules
)
_childrenOrulemap =
(
_splitVRules
)
_childrenOinhMap =
(
_lhsIinhMap
)
_childrenOsynMap =
(
_lhsIsynMap
)
( _childrenIvchildren) =
children_ _childrenOinhMap _childrenOrulemap _childrenOsynMap
( _rulesIvrules) =
rules_
___node =
(Syn_Production _lhsOvprod)
in ( _lhsOvprod))))
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 Identifier Attributes) ->
(Map Identifier Attributes) ->
( ([VisageProduction])))
data Inh_Productions = Inh_Productions {inhMap_Inh_Productions :: (Map Identifier Attributes),synMap_Inh_Productions :: (Map Identifier Attributes)}
data Syn_Productions = Syn_Productions {vprods_Syn_Productions :: ([VisageProduction])}
wrap_Productions :: T_Productions ->
Inh_Productions ->
Syn_Productions
wrap_Productions (T_Productions sem) (Inh_Productions _lhsIinhMap _lhsIsynMap) =
(let ( _lhsOvprods) = sem _lhsIinhMap _lhsIsynMap
in (Syn_Productions _lhsOvprods))
sem_Productions_Cons :: T_Production ->
T_Productions ->
T_Productions
sem_Productions_Cons (T_Production hd_) (T_Productions tl_) =
(T_Productions (\ _lhsIinhMap
_lhsIsynMap ->
(let _lhsOvprods :: ([VisageProduction])
_hdOinhMap :: (Map Identifier Attributes)
_hdOsynMap :: (Map Identifier Attributes)
_tlOinhMap :: (Map Identifier Attributes)
_tlOsynMap :: (Map Identifier Attributes)
_hdIvprod :: VisageProduction
_tlIvprods :: ([VisageProduction])
_lhsOvprods =
(
_hdIvprod : _tlIvprods
)
_hdOinhMap =
(
_lhsIinhMap
)
_hdOsynMap =
(
_lhsIsynMap
)
_tlOinhMap =
(
_lhsIinhMap
)
_tlOsynMap =
(
_lhsIsynMap
)
( _hdIvprod) =
hd_ _hdOinhMap _hdOsynMap
( _tlIvprods) =
tl_ _tlOinhMap _tlOsynMap
___node =
(Syn_Productions _lhsOvprods)
in ( _lhsOvprods))))
sem_Productions_Nil :: T_Productions
sem_Productions_Nil =
(T_Productions (\ _lhsIinhMap
_lhsIsynMap ->
(let _lhsOvprods :: ([VisageProduction])
_lhsOvprods =
(
[]
)
___node =
(Syn_Productions _lhsOvprods)
in ( _lhsOvprods))))
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 (( VisageRule))
data Inh_Rule = Inh_Rule {}
data Syn_Rule = Syn_Rule {vrule_Syn_Rule :: VisageRule}
wrap_Rule :: T_Rule ->
Inh_Rule ->
Syn_Rule
wrap_Rule (T_Rule sem) (Inh_Rule) =
(let ( _lhsOvrule) = sem
in (Syn_Rule _lhsOvrule))
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 (let _lhsOvrule :: VisageRule
_patternIcopy :: Pattern
_patternIfieldattrs :: ( [(Identifier,Identifier)] )
_patternIself :: Pattern
_patternIvpat :: VisagePattern
_rhsIself :: Expression
_lhsOvrule =
(
VRule _patternIfieldattrs undefined _patternIvpat _rhsIself owrt_
)
( _patternIcopy,_patternIfieldattrs,_patternIself,_patternIvpat) =
pattern_
( _rhsIself) =
rhs_
___node =
(Syn_Rule _lhsOvrule)
in ( _lhsOvrule)))
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 (( ([VisageRule])))
data Inh_Rules = Inh_Rules {}
data Syn_Rules = Syn_Rules {vrules_Syn_Rules :: ([VisageRule])}
wrap_Rules :: T_Rules ->
Inh_Rules ->
Syn_Rules
wrap_Rules (T_Rules sem) (Inh_Rules) =
(let ( _lhsOvrules) = sem
in (Syn_Rules _lhsOvrules))
sem_Rules_Cons :: T_Rule ->
T_Rules ->
T_Rules
sem_Rules_Cons (T_Rule hd_) (T_Rules tl_) =
(T_Rules (let _lhsOvrules :: ([VisageRule])
_hdIvrule :: VisageRule
_tlIvrules :: ([VisageRule])
_lhsOvrules =
(
_hdIvrule : _tlIvrules
)
( _hdIvrule) =
hd_
( _tlIvrules) =
tl_
___node =
(Syn_Rules _lhsOvrules)
in ( _lhsOvrules)))
sem_Rules_Nil :: T_Rules
sem_Rules_Nil =
(T_Rules (let _lhsOvrules :: ([VisageRule])
_lhsOvrules =
(
[]
)
___node =
(Syn_Rules _lhsOvrules)
in ( _lhsOvrules)))
sem_TypeSig :: TypeSig ->
T_TypeSig
sem_TypeSig (TypeSig _name _tp) =
(sem_TypeSig_TypeSig _name _tp)
newtype T_TypeSig = T_TypeSig (( ))
data Inh_TypeSig = Inh_TypeSig {}
data Syn_TypeSig = Syn_TypeSig {}
wrap_TypeSig :: T_TypeSig ->
Inh_TypeSig ->
Syn_TypeSig
wrap_TypeSig (T_TypeSig sem) (Inh_TypeSig) =
(let ( ) = sem
in (Syn_TypeSig))
sem_TypeSig_TypeSig :: Identifier ->
Type ->
T_TypeSig
sem_TypeSig_TypeSig name_ tp_ =
(T_TypeSig (let ___node =
(Syn_TypeSig)
in ( )))
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 (( ))
data Inh_TypeSigs = Inh_TypeSigs {}
data Syn_TypeSigs = Syn_TypeSigs {}
wrap_TypeSigs :: T_TypeSigs ->
Inh_TypeSigs ->
Syn_TypeSigs
wrap_TypeSigs (T_TypeSigs sem) (Inh_TypeSigs) =
(let ( ) = sem
in (Syn_TypeSigs))
sem_TypeSigs_Cons :: T_TypeSig ->
T_TypeSigs ->
T_TypeSigs
sem_TypeSigs_Cons (T_TypeSig hd_) (T_TypeSigs tl_) =
(T_TypeSigs (let ___node =
(Syn_TypeSigs)
in ( )))
sem_TypeSigs_Nil :: T_TypeSigs
sem_TypeSigs_Nil =
(T_TypeSigs (let ___node =
(Syn_TypeSigs)
in ( )))