Parsimmon is a compact, monadic LL(infinity) parser combinator library for JavaScript, enabling the construction of complex parsers from smaller, composable units. It is currently at version 1.18.1 and supports both modern Node.js environments and older browser versions (down to IE7). Its release cadence appears to be infrequent, with the last major feature release (1.7.0) being in 2018, though bug fixes and minor updates have occurred more recently. Key differentiators include its inspiration from Haskell's Parsec and Promises/A+ for its API design, its support for binary parsing using Node.js Buffers, and its compatibility with the Fantasy Land specification, implementing several algebraic structures like Semigroup, Apply, Applicative, Functor, Chain, and Monad. It distinguishes itself by offering a functional and declarative approach to parsing, making grammars easy to read and maintain.
npm install parsimmonVerified import paths — ran on the pinned version, not inferred.
Demonstrates defining basic parsers for digits and operators, combining them to parse arithmetic expressions and comma-separated lists, and handling parse results.
Always import the main `Parsimmon` object as a default import (e.g., `import Parsimmon from 'parsimmon'`) and access static methods or parser methods via `Parsimmon.<methodName>` or `parserInstance.<methodName>`.
Update `parser.empty` calls to `parser.empty()` and adjust the order of arguments for `ap` to `x.ap(f)`.
Ensure `Parsimmon.seqMap` is always called with at least one parser argument and that the last argument is a mapping function.
Review `Parsimmon.regexp` usage and ensure only `i`, `m`, or `u` flags are used. Adjust regular expressions or parsing logic if other flags were previously relied upon.
Evaluate active community support and contribution patterns on the GitHub repository for critical, time-sensitive projects. Consider contributing or preparing for self-maintenance if specific niche features or rapid development are required.
Import the `Parsimmon` object as a default import and access methods via `Parsimmon.string` (e.g., `import Parsimmon from 'parsimmon'; const myParser = Parsimmon.string('hello');`).For browsers, ensure a `<script>` tag loading the UMD build (e.g., from unpkg) is present before attempting to use `Parsimmon`. For Node.js, use `const Parsimmon = require('parsimmon');` or `import Parsimmon from 'parsimmon';` to import the library.Inspect the input string for unexpected characters or malformed data. Adjust the parser definition to correctly handle the expected input format, or add `.or()` combinators to handle alternative valid patterns. The error message from `parser.parse(input)` usually provides line and column details.
No dependency data recorded yet.