Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yallop/ocaml-asp
Algebraic, staged parsing for OCaml: typed, compositional, and faster than yacc
https://github.com/yallop/ocaml-asp
functional-programming high-performance metaocaml ocaml parser-combinators parsing
Last synced: 15 days ago
JSON representation
Algebraic, staged parsing for OCaml: typed, compositional, and faster than yacc
- Host: GitHub
- URL: https://github.com/yallop/ocaml-asp
- Owner: yallop
- License: mit
- Created: 2018-09-05T16:06:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-01T08:13:01.000Z (over 1 year ago)
- Last Synced: 2025-01-11T18:47:05.120Z (22 days ago)
- Topics: functional-programming, high-performance, metaocaml, ocaml, parser-combinators, parsing
- Language: OCaml
- Homepage:
- Size: 17.8 MB
- Stars: 100
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
## asp: algebraic, staged parsing
`asp` is a typed, algebraic parser combinator library with some unusual features:
* `asp` parsers are checked using an internal type system before they are
run to ensure that the grammars they describe are unambiguous and
free from left-recursion.These constraints ensure that the input can be parsed in linear
time without backtracking and with a single token of lookahead.* `asp` uses multi-stage programming to achieve much higher
performance than most combinator libraries. Parsers constructed
with `asp` can be compiled at runtime to efficient code that
typically outperforms parsers written with the standard OCaml
parser-generator `ocamlyacc`
The following paper has many more details:A typed, algebraic approach to parsing ([pdf][paper])
Neelakantan R. Krishnaswami and Jeremy Yallop
PLDI 2019
(received Distinguished Paper Award & Distinguished Artifact Award)## Trying out asp
The [pldi-artifact](pldi-artifact) directory contains instructions for running the artifact, which can be used to try out the library and reproduce the benchmarks without installing the software.
## Installation
1. Install the [BER MetaOCaml][ber-metaocaml] compiler using [OPAM][opam]:
```
opam switch 4.11.1+BER
eval $(opam env)
```2. Add the [metaocaml-opam][metaocaml-opam] repository:
```
opam remote add metaocaml git+https://github.com/metaocaml/metaocaml-opam.git
```3. Install the `asp` package:
```
opam install asp
```## Running the benchmarks
Clone the repository and type `make bench`.
[paper]: https://www.cl.cam.ac.uk/~jdy22/papers/a-typed-algebraic-approach-to-parsing.pdf
[opam]: https://opam.ocaml.org/
[letrec]: https://github.com/yallop/metaocaml-letrec
[ber-metaocaml]: http://okmij.org/ftp/ML/MetaOCaml.html
[metaocaml-opam]: https://github.com/metaocaml/metaocaml-opam/