module Grammar.Core (
grammar
, Grammar
, ObjectFlow (..)
, RuleSequence
, NamedProduction
, getProductionName
, getProduction
, start
, constraints
, rules
, findProduction
, reachableGraphs
, addReachableGraphs
) where
import Abstract.AdhesiveHLR
import Abstract.DPO.Core
import Abstract.Morphism
type NamedProduction m = (String, Production m)
data Grammar m =
Grammar {
start :: Obj m
, constraints :: [Constraint m]
, rules :: [NamedProduction m]
, reachableGraphs :: [(String, Obj m)]
}
grammar :: Obj m -> [Constraint m] -> [NamedProduction m] -> Grammar m
grammar s c r = Grammar s c r []
addReachableGraphs :: [(String, Obj m)] -> Grammar m -> Grammar m
addReachableGraphs gs' (Grammar s c r gs) = Grammar s c r (gs ++ gs')
getProductionName :: NamedProduction m -> String
getProductionName = fst
getProduction :: NamedProduction m -> Production m
getProduction = snd
findProduction :: String -> Grammar m -> Maybe (Production m)
findProduction name grammar = lookup name (rules grammar)
data ObjectFlow m =
ObjectFlow {
index :: String
, producer :: String
, consumer :: String
, spanMapping :: Span m
}
type RuleSequence m = (String,[(String, Production m)],[ObjectFlow m])