Commit bf237e7a authored by Jente Hidskes's avatar Jente Hidskes

GrammarSemantics: add CoComplete instance for GrammarBuilder

parent b7522247
......@@ -150,6 +150,9 @@ instance PreOrd (GrammarBuilder Constr) where
instance Complete (GrammarBuilder Constr) where
() = union
instance CoComplete (GrammarBuilder Constr) where
() = intersection
instance ArrowApply (Interp s) where
app = Interp $ (\(Interp f, b) -> (f,b)) ^>> app
......@@ -191,7 +194,7 @@ instance IsTerm Term (Interp s) where
matchTermAgainstNumber = proc (n,Term g) -> matchLit -< (normalize (epsilonClosure g), NumLit n)
matchTermAgainstString = proc (s,Term g) -> matchLit -< (normalize (epsilonClosure g), StringLit s)
equal = proc (Term g1, Term g2) -> case intersection g1 g2 of
equal = proc (Term g1, Term g2) -> case g1 g2 of
g | isEmpty g -> fail -< ()
| isSingleton (normalize (epsilonClosure g1)) && isSingleton (normalize (epsilonClosure g2)) -> returnA -< Term g
| otherwise -> returnA fail' -< Term g
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment