Engelberg/instaparse — pull request #50 by mullr (2013-10-06 12:23:34+00:00)
Title: Port instaparse to clojurescript

This is not really a pull request yet, but it may grow up to become one someday.

This is a partially working port to clojurescript. It has problems:
- 4 core tests don't pass
- It can't parse the abnf parser definition
- It's very slow, even with just the tests.

Of course I encountered the two obvious issues when doing the port:
- auto-flatten-seq works, but isn't a full port. The two important parts require for it to work are hash-conj and hash-cat. Since clojurescript uses a different hashing algorithm for its sequences, the existing code doesn't work. Hash-conj is easy with the cljs scheme, but hash-cat really is not. (I'm not even sure it's possible, actually) The current implementation rehashes the collection every time.

- The javax.swing.text.Segment class is replaced with a clojurescript implementation with roughly the same semantics. Unfortunately, there's no way that I know to deal with the underlying array of a string (and in effect start regular expression matching at a certain index). There's a note about a possible optimization in the current source. It may also be worth implementing custom regular expression matcher just to be able to start in the middle of a string.

I've done no profiling on this so far, so the above performance notes, while likely true, could be way off.