caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jun Furuse <jun.furuse@gmail.com>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] [ANN] Planck: a small monadic parser combinator library for OCaml
Date: Sat, 28 May 2011 11:11:00 +0900	[thread overview]
Message-ID: <BANLkTi=p5TMM=s4qtEB_9ES=pzvMBnRJQQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1649 bytes --]

Hi,

I've released a small monadic parser combinator library for OCaml, Planck
version 1.0.0, available at:

    https://bitbucket.org/camlspotter/planck/get/v1.0.0.tar.gz

It is firstly just for my fun to learn what is Parsec/parser combinators,
but it is now elaborated to something useful:

    - input positions by lines and columns
    - char specialized stream for better performance
    - operator precedence/associativity resolver
    - memoization module for efficient backtracks

For example I could implement OCaml syntax lexer and parser using Planck.

REQUIREMENTS: unfortunately Planck depends on many things:

  - ocaml 3.12.0 or higher
  - findlib
  - omake
  - type-conv 2.3.0 and sexplib 5.2.1 (available from
http://ocaml.janestreet.com/?q=node/13)
  - spotlib (my small utility functions, available at
http://bitbucket.org/camlspotter/spotlib/ )

  The followings are required to compiler ocaml syntax parser example:
  - pa_monad_custom ( http://bitbucket.org/camlspotter/pa_monad_custom/
  - ocaml 3.12.0 source tree and lablgtk-2.14.2 source code tree for testing

The combinators in Planck are implemented simply as functional monadic
combinators over streams (lazy lists). Unfortunately, it is very slow with
the current OCaml compiler (3.12.0) due to its huge closure constructions:
it is about x100 slower than the traditional ocamllex+ocamlyacc. I hope more
aggressive in-lining optimizations in the compiler might speed up the
performance of Planck greatly. You can read some of my rough considerations
in this topic at:


http://camlspotter.blogspot.com/2011/05/planck-small-parser-combinator-library.html

Enjoy,

Jun

[-- Attachment #2: Type: text/html, Size: 2120 bytes --]

             reply	other threads:[~2011-05-28  2:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28  2:11 Jun Furuse [this message]
2011-05-29  9:14 ` Gabriel Scherer
2011-06-06  6:42   ` Jun Furuse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=p5TMM=s4qtEB_9ES=pzvMBnRJQQ@mail.gmail.com' \
    --to=jun.furuse@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).