diff --git a/README.md b/README.md index 51670e6..6c46c7f 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/mod.ts b/mod.ts index abe3606..054e6d0 100644 --- a/mod.ts +++ b/mod.ts @@ -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: * @@ -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 diff --git a/src/combinators/alternation/alt.ts b/src/combinators/alternation/alt.ts index 6dfe19b..9a7a421 100644 --- a/src/combinators/alternation/alt.ts +++ b/src/combinators/alternation/alt.ts @@ -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), diff --git a/src/combinators/recursion/mod.ts b/src/combinators/recursion/mod.ts index 8d907fe..70c4aa4 100644 --- a/src/combinators/recursion/mod.ts +++ b/src/combinators/recursion/mod.ts @@ -1,2 +1,8 @@ +/** + * Reduction combinators + * + * @module + */ + export { lazy } from "./lazy.ts"; export { memoize } from "./memoize.ts"; diff --git a/src/core/mod.ts b/src/core/mod.ts index 54e840c..e7c1fc8 100644 --- a/src/core/mod.ts +++ b/src/core/mod.ts @@ -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"; diff --git a/src/core/types.ts b/src/core/types.ts index 45d3676..08935fb 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -1,7 +1,5 @@ /** * The current position in the source - * - * @internal */ export type Position = { line: number;