Skip to content

Commit

Permalink
some tweaks to README, travis, and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
smolkaj committed Jul 28, 2019
1 parent 2180b79 commit 4f731fa
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .travis.docgen.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash
# From https://github.com/simonjbeaumont/ocaml-travis-gh-pages

set -e
# Make sure we're not echoing any sensitive data
set +x
set -o errexit -o nounset
Expand All @@ -22,6 +21,7 @@ rm -rf $DOCDIR

git clone https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG} $DOCDIR 2>&1 | sed -e "s/$GH_TOKEN/!REDACTED!/g"
git -C $DOCDIR checkout gh-pages || git -C $DOCDIR checkout --orphan gh-pages
git -C $DOCDIR clean -xdf

DOCFILES=$(echo $DOCSRC/*)
cp -R $DOCFILES $DOCDIR
Expand Down
15 changes: 15 additions & 0 deletions .travis.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
echo "yes" | sudo add-apt-repository ppa:avsm/ppa
sudo apt-get update -qq
sudo apt-get install -qq opam
export OPAMYES=1
if ! opam switch $OCAML; then
rm -rf ~/.opam/$OCAML
opam init --yes --bare
opam switch create $OCAML
fi
eval $(opam env)
opam upgrade --yes --all
opam pin remove --yes $PACKAGE; opam pin add --yes --no-action $PACKAGE .
opam install --yes --deps-only $PACKAGE
opam install --yes --verbose --build-doc --build-test --keep-build-dir $PACKAGE
15 changes: 3 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ env:
- OCAML=4.07.1
- OCAML=4.08.0
script:
- echo "yes" | sudo add-apt-repository ppa:avsm/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq opam
- export OPAMYES=1
- opam init --auto-setup --compiler=$OCAML --reinit
- opam switch $COMPILER
- eval `opam config env`
- opam upgrade --yes --all
- opam pin add --yes --no-action $PACKAGE .
- opam install --yes --deps-only $PACKAGE
- opam install --yes --verbose --build-doc --build-test --keep-build-dir $PACKAGE
- bash -ex .travis.docgen.sh
- bash -exuv .travis.test.sh
- bash -exuv .travis.docgen.sh
- opam pin remove --yes $PACKAGE
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
*For an older version of this repository based on sedlex, refer to the [sedlex branch](../../tree/sedlex)*.

# Nice_parser [![Build Status](https://travis-ci.org/smolkaj/ocaml-parsing.svg?branch=master)](https://travis-ci.org/smolkaj/ocaml-parsing)
# *Nice Parser* [![Build Status](https://travis-ci.org/smolkaj/ocaml-parsing.svg?branch=master)](https://travis-ci.org/smolkaj/ocaml-parsing)

Writing a parser in OCaml ~requires~ used to require a lot of boilerplate code.
Nice_parser changes this:
1. The [`nice_parser`](src/) library (API documented [here](http://smolkaj.github.io/ocaml-parsing/nice_parser/)) consolidates boilerplate code that can be shared among all parsers, providing a sane interface (with beautiful error messages) to your \{menhir, ocamlyacc\}-generated parser.
2. The [example](example) folder contains a fully functional parser skeleton based on `Nice_parser` and standard tools:
Writing an OCaml parser with nice error messages should be easy - and now it is!
*Nice Parser* comes in two parts:

1. **lib/**: The [`nice_parser`](lib/) library (API documented [here](http://smolkaj.github.io/ocaml-parsing/nice_parser/)) consolidates boilerplate code and wraps your auto-generated parser in a *nice* interface with beautiful error messages.
2. **example/**: The example parser lets you get started on your own parser in seconds. It is based on [`nice_parser`](lib/) and standard tools:
* [Menhir](http://gallium.inria.fr/~fpottier/menhir/), a LR(1) parser generator.
* [ocamllex](https://caml.inria.fr/pub/docs/manual-ocaml/lexyacc.html), OCaml's built-in lexer generator.
* Jane Street's [dune](https://dune.build/), the inofficial standard build system for OCaml.
* Jane Street's [base](https://opensource.janestreet.com/base/), the inofficial standard library for OCaml.
* Jane Street's [dune](https://dune.build/) and [base](https://opensource.janestreet.com/base/), the de-facto standard built tool and standard library for OCaml.

You can get started with your own parser in seconds:
Using the library and the skeleton, you can get started on your own parser in seconds:
```sh
opam install nice_parser # install the nice_parser library
git clone https://github.com/smolkaj/ocaml-parsing.git # clone this repository
cd ocaml-parsing && rm -r src && mv example src # use example as starting point
cd ocaml-parsing && rm -r lib && mv example src # use example as starting point
dune build src/example.a # try to build...
dune exec src/bin/main.exe # ...and run your parser!
```
Expand Down Expand Up @@ -44,9 +44,9 @@ The [example skeleton](example) should be self-explanatory.

## How to build
Ideally, use OCaml 4.08 or higher (for [beautiful error messages](https://github.com/ocaml/ocaml/pull/2096)).
The project can be built using [dune](dune.build).
The project can be built using [dune](https://dune.build).
Consult the [dune-project file](dune-project) for the necessary dependencies;
all can be installed using [opam](http://opam.ocaml.org), OCaml's packet manager.
all of them can be installed using the [opam](http://opam.ocaml.org) packet manager.

## Suggestions and Improvements
Suggestions and changes are welcome. Please submit pull requests, or open issues.
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
(depends
(ocaml (>= 4.05.0))
(dune (and :build (>= 1.10)))
(menhir :build)
(stdio (<> 0))
(base (<> 0))
(base :with-test)
(menhir :with-test)
(ppx_jane :with-test)
(ppx_inline_test :with-test)
(ppx_expect :with-test)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions nice_parser.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ description:
depends: [
"ocaml" {>= "4.05.0"}
"dune" {build & >= "1.10"}
"menhir" {build}
"stdio" {!= "0"}
"base" {!= "0"}
"base" {with-test}
"menhir" {with-test}
"ppx_jane" {with-test}
"ppx_inline_test" {with-test}
"ppx_expect" {with-test}
Expand Down

0 comments on commit 4f731fa

Please sign in to comment.