@startuml

set namespaceseparator none
skinparam dpi 96
skinparam ArrowColor Black
skinparam shadowing true
skinparam class {
  backgroundColor Business
  borderColor Red
}
skinparam object {
  backgroundColor lavender
  borderColor black
}

abstract class RewriteRule {}
class SimpleRewriteRule {
    template
}
class CoordinationRewriteRule {}
class CurryRewriteRule {}
class Rewriter {
    apply_rewrites()
}
class UnknownWordsRewriteRule {
  {static} from_diagrams()
}

abstract class DiagramRewriter {
  matches()
  rewrite()
}
class UnifyCodomainRewriter {}
class RemoveCupsRewriter {}
class RemoveSwapsRewriter {}

object connector_rule
object determiner_rule
object postadverb_rule
object preadverb_rule
object auxiliary_rule
object prep_phrase_rule
object object_rp_rule
object subject_rp_rule

RewriteRule <|-- SimpleRewriteRule
RewriteRule <|-- CoordinationRewriteRule
RewriteRule <|-- CurryRewriteRule
RewriteRule <|-- UnknownWordsRewriteRule

DiagramRewriter <|-- UnifyCodomainRewriter
DiagramRewriter <|-- RemoveCupsRewriter
DiagramRewriter <|-- RemoveSwapsRewriter

Rewriter *-d- RewriteRule
SimpleRewriteRule::template *-- backend.grammar.Diagram
Rewriter::apply_rewrites *-r- backend.grammar.Functor
RewriteRule -- backend.grammar.Diagram : > rewrites

SimpleRewriteRule <.u. connector_rule : <<instanceOf>>
SimpleRewriteRule <.u. determiner_rule : <<instanceOf>>
SimpleRewriteRule <.u. postadverb_rule : <<instanceOf>>
SimpleRewriteRule <.l. preadverb_rule : <<instanceOf>>
SimpleRewriteRule <.. auxiliary_rule : <<instanceOf>>
SimpleRewriteRule <.. prep_phrase_rule : <<instanceOf>>
SimpleRewriteRule <.. object_rp_rule : <<instanceOf>>
SimpleRewriteRule <.. subject_rp_rule : <<instanceOf>>

@enduml
