Parsing combinators are a beautiful and convincing example showing the
elegance
and power of functional programming.
I have implemented parsing combinators many times but never done them in
CPS-style
until now. After giving a presentation of session combinators of CPS-style
(which is done
out of necessity due to the runtime of JS being single threaded), I
realized that this style
can be quite attractive for implementing parsing combinators as well. But
certainly not limited
to passing combinators. Hopefully, you can use the same style to build you
own libraries.
See:
http://ats-lang.sourceforge.net/EXAMPLE/EFFECTIVATS/parsing-cmbntr-cps/index.html
Cheers!