unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Junpeng Qiu <qjpchmail@gmail.com>
To: emacs-devel@gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: [ELPA] New package: parsec
Date: Tue, 25 Oct 2016 16:17:29 -0400	[thread overview]
Message-ID: <CAKzohg+SsjqE3639M_CTSLz2H1sBqOG13whEN_xawG5mgqXG_Q@mail.gmail.com> (raw)

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

Hello Emacs,

I've added a new package "parsec" to GNU ELPA (hoping I've not messed up
anything). This is a parser combinator library for Emacs Lisp, similar to
Haskell's parsec. The work is inspired by John's [emacs-pl]. The main repo
of parsec is on GitHub: https://github.com/cute-jumper/parsec.el.

John's [emacs-pl] is awesome, but I found following problems when I tried
to use it:
- it only contains a very limited set of combinators
- Some of its functions (combinators) have different behaviors than their
Haskell counterparts
- It can't show error messages when parsing fails.

The new library, parsec, contains most of the parser combinators in
"Text.Parsec.Combinator" (I'm adding more gradually), and I tried my best
to keep their behavior the same as their Haskell counterparts so that
programmer with Haskell background could easily use the library. You can
see the table listing all of the functions/macros in the README. It's a
long list so I'll skip it here. Parsec also comes with a simple error
handling mechanism, which may be improved in the future.

To give a short example, the following code extract the "hello" from the
comment:

  (parsec-with-input "/* hello */"
    (parsec-string "/*")
    (parsec-many-till-as-string (parsec-any-ch)
                                (parsec-try
                                 (parsec-string "*/"))))

More examples can be found at
https://github.com/cute-jumper/parsec.el/tree/master/examples.

[emacs-pl]: https://github.com/cute-jumper/parsec.el

Thanks,
-Junpeng

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

             reply	other threads:[~2016-10-25 20:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 20:17 Junpeng Qiu [this message]
2016-10-25 20:23 ` [ELPA] New package: parsec Junpeng Qiu
2016-10-25 21:46   ` John Wiegley
2016-10-26  1:46     ` Junpeng Qiu

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAKzohg+SsjqE3639M_CTSLz2H1sBqOG13whEN_xawG5mgqXG_Q@mail.gmail.com \
    --to=qjpchmail@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).