Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@

# Monarch

Monarch is a full-featured type-safe parser combinator library with:
Monarch is a clean, composable parser combinator library that makes building
parsers feel natural and expressive:

- Precise error messages reports with position
- Clean & readable API
- Type-safe parsing
- Precise error reports with position
- Support for custom error messages
- Support for ambiguous grammars
- Support for context-sensitive grammars
- Support for left-recursive grammars with [fold](#foldl-and-foldr) and
[lazy evaluation](#lazy-evaluation)
- Full type-safety

Easily build an error-reporting parser by combining, extending and customizing
the provided base parsers and their error messages.
Easily build error-reporting parsers by combining, extending and customizing the
provided base parsers and their error messages.

## Table of content

Expand Down
19 changes: 18 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
/**
* Build parsers by composing structural combinators and chaining semantic refinements
* ## Features
*
* - Clean & readable API
* - Type-safe parsing
* - Precise error reports with position
* - Support for custom error messages
* - Support for ambiguous grammars
* - Support for context-sensitive grammars
* - Support for left-recursive grammars with fold and lazy evaluation
*
* Easily build error-reporting parsers by combining, extending and customizing
the provided base parsers and their error messages.
*
* ## Structural Combinators & Semantic Refinements
*
* To build parsers with Monarch you compose structural combinators and chain semantic refinements.
*
* Combinators describe your grammar with function composition:
*
Expand All @@ -16,6 +31,8 @@
* - [mapping](https://jsr.io/@fcrozatier/monarch/doc/~/Parser.prototype.map)
* - [skipping](https://jsr.io/@fcrozatier/monarch/doc/~/Parser.prototype.skipTrailing)
*
* ## Guide
*
* For a introductory walkthrough of the various combinators, see the following [guide](https://github.com/fcrozatier/monarch?tab=readme-ov-file#getting-started-guide)
*
* @module
Expand Down
2 changes: 1 addition & 1 deletion src/combinators/alternation/alt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { sortPosition } from "../../utils.ts";
* @example Signed integers
*
* ```ts
* import { integer, literal, natural } from "@fcrozatier/monarch/common";
* import { literal, natural } from "@fcrozatier/monarch/common";
*
* const integer = alt(
* literal("-").chain(() => natural).map((x) => -x),
Expand Down
6 changes: 6 additions & 0 deletions src/combinators/recursion/mod.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
/**
* Reduction combinators
*
* @module
*/

export { lazy } from "./lazy.ts";
export { memoize } from "./memoize.ts";
2 changes: 1 addition & 1 deletion src/core/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

export { createParser, Parser } from "./parser.ts";
export { result } from "./result.ts";
export type { ParseFail, ParseResult, ParseSuccess } from "./types.ts";
export * from "./types.ts";
export { fail } from "./fail.ts";
2 changes: 0 additions & 2 deletions src/core/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/**
* The current position in the source
*
* @internal
*/
export type Position = {
line: number;
Expand Down