package parkour
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c4a3f934273430011f6c4862c035395268c47b2cdaba52c199f97cf0404dfba9
sha512=45194b2c7d5f8bcc9d2cb92d640b9dff17b2a3d4ad7319c006daf523923d8c69cdaf53e11d25ba01d5a470b027e4fa1788a69669d11481db20773cef6cc6fa49
doc/README.html
Parkour
A parser-combinator library for OCaml, for human-authored text (config files, DSLs, small languages). It aims for precise syntax errors, a pleasant API, opt-in error recovery and stack safety on long and deeply nested input. No runtime dependencies beyond the OCaml standard library.
open Parkour
let point =
let+ x = integer <* char ',' and+ y = integer in
(x, y)
let () =
match parse point "3,x" with
| Ok (x, y) -> Printf.printf "%d %d\n" x y
| Error ds ->
let source = Source.make ~name:"point" "3,x" in
List.iter (fun d -> print_string (Diagnostic.render source d)) dsprints
error: expected integer, found 'x'
--> point:1:3
|
1 | 3,x
| ^ expected integerDocumentation
A tutorial and the API reference, built with
dune build @doc(open _build/default/_doc/_html/index.html). The examples/ directory has complete parsers (JSON, CSV, typed values, a calculator, a configuration format with error recovery, a small C-like language), each with a gallery of broken inputs and the errors they produce.
Development
Command | |
|---|---|
| build the library |
| fast test tier |
| extensive test tier (QCheck |
| format the sources |
| benchmarks (unpackaged; |
See CHANGES for the release notes. License: MIT (see LICENSE).