Skip to content

Instantly share code, notes, and snippets.

View jdnier's full-sized avatar

David Niergarth jdnier

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jdnier on github.
  • I am dniergarth (https://keybase.io/dniergarth) on keybase.
  • I have a public key ASBCKmLlxbDLfBBPITqvULtAqFvdw83BjP99tUm8o6z3fgo

To claim this, I am signing this object:

@jdnier
jdnier / derivatives.py
Created March 19, 2018 03:02 — forked from elfsternberg/derivatives.py
Python parsing with derivatives.
#!/usr/bin/env python
# This file implements Brzozowski's parsing-with-derivatives (see:
# https://arxiv.org/abs/1604.04695) with fairly simple and
# straightforward Python code. This implementation is naive and
# subject to exponential memory growth in the worst case; in practice,
# average complexity is closer to linear. This version recalculates
# derivatives every time they are needed; memoization, the first and
# most obvious optimization, is not implemented.
#