Skip to content

smolkaj/nice-parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocaml-parsing

Writing a parser in OCaml requires a surprising amount of boilerplate code. This is a fully functional skeleton using standard tools:

  • Menhir, a LR(1) parser generator.
  • Sedlex, a lexer generator with Unicode support.
  • Jane Street's base, the inofficial standard library for OCaml.
  • Jane Street's dune (formerly jbuilder), an OCaml build system.

How to build

With opam, OCaml's packet manager, all dependencies can be installed automatically:

opam update                                     # ensure opam is up to date
opam switch 4.06                                # install OCaml 4.06
eval `opam config env`                          # set env variables
opam pin add --yes --no-action ocaml_parsing .  # install other...
opam install --yes --deps-only ocaml_parsing    # ...dependencies

Then, simply run make to build, and make test to build and run the test file. (The final test will result in an error message, this is expected.)

The code has been last tested with OCaml 4.06.

Suggestion and Improvements

Feel free to submit pull requests. Suggestions and changes are welcome.