def __init__(self): self.empty = empty self.lit = memoize(_lit) self.mkalt = memoize(self._alt) self.mkseq = memoize(self._seq) self.mkmany = memoize(self._many)
def mark(nullable, deriv, tag, args): deriv.nullable = nullable deriv.tag = tag deriv.args = args deriv.deriv = memoize(deriv) return deriv