pcomb

a parser combinator library in TypeScript

I think that parser combinators are conceptually cool. They are fun to work with and elegant.

Are they the most efficient or most powerful approach to writng parsers? No. Don't use them to write a compiler or a high-preformance data transformation tool. They won't help you much with processing natural languages.

OK, with that out of the way, pcomb is a TypeScript library that provides you with the basic plumbing to create your own custom parser.

I have no idea how performant it is, and I don't intend to do any work to measure such things. It's really meant more to be an exploration of the concept of parser combinators as well as some of TypeScript's more interesting features.

Play around with the sample app that comes with the source code. It will solve simple math problems for you. Sound stupidly simple? It kind of is, but try lots of different combinations of words and symbols, like this:

6 * 6
six times six
6 times sixty-six
Then, look at the source code for it, and see how the parser is put together. Kinda neat in my opinion.

Use it, don't use it. Appreciate it, loathe it, whatever. It lives on github.