-
Notifications
You must be signed in to change notification settings - Fork 3
/
pacomb.opam
65 lines (51 loc) · 2.37 KB
/
pacomb.opam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
synopsis: "Parsing library based on combinators and ppx extension to write languages"
description:
"""
Pacomb is a parsing library that compiles grammars to combinators prior to
parsing together with a PPX extension to write parsers inside OCaml files.
The advantages of Pacomb are
- Grammars as first class values defined in your OCaml files. This is
an example from the distribution:
(* The three levels of priorities *)
type p = Atom | Prod | Sum
let%parser rec
(* This includes each priority level in the next one *)
expr p = Atom < Prod < Sum
(* all other rule are selected by their priority level *)
; (p=Atom) (x::FLOAT) => x
; (p=Atom) '(' (e::expr Sum) ')' => e
; (p=Prod) (x::expr Prod) '*' (y::expr Atom) => x*.y
; (p=Prod) (x::expr Prod) '/' (y::expr Atom) => x/.y
; (p=Sum ) (x::expr Sum ) '+' (y::expr Prod) => x+.y
; (p=Sum ) (x::expr Sum ) '-' (y::expr Prod) => x-.y
- Good performances:
- on non ambiguous grammars, 2 to 3 time slower compared to ocamlyacc
- on ambiguous grammars O(N^3 ln(N)) can be achieved.
- Parsing from left to right (despite the use of combinators) allowing not
to keep the whole input in memory and allowing to parse streams.
- Dependant sequence allowing for self extensible grammars (like new infix
with a given priority in a given example).
- Managing of blanks that for instance allows for nested language using
different kind of comments or blanks.
- Support for cache and merge for ambiguous grammars (to get O(N^3 ln(N)))
- Enough support for utf8 to write parser for a language using utf8.
- Comes with documentation and various examples illustrating most possibilities.
All this makes Pacomb a promising solution to write languages in OCaml.
"""
opam-version: "2.0"
maintainer: "Christophe Raffalli <[email protected]>"
bug-reports: "https://github.com/craff/pacomb/issues"
homepage: "https://github.com/craff/pacomb"
dev-repo: "git+https://github.com/craff/pacomb.git"
authors: [
"Christophe Raffalli <[email protected]>"
"Rodolphe Lepigre <[email protected]>" ]
license: "MIT"
depends: [
"ocaml" { >= "4.04.1" }
"dune" { >= "1.9.0" }
"ppxlib" { >= "0.10.0" }
"stdlib-shims"
]
build: [ [ "dune" "build" "-p" name "-j" jobs ] ]
run-test: [ [ "dune" "runtest" "-p" name "-j" jobs ] ]