unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [ELPA] New package: parsec
@ 2016-10-25 20:17 Junpeng Qiu
  2016-10-25 20:23 ` Junpeng Qiu
  0 siblings, 1 reply; 4+ messages in thread
From: Junpeng Qiu @ 2016-10-25 20:17 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-26  1:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-25 20:17 [ELPA] New package: parsec Junpeng Qiu
2016-10-25 20:23 ` Junpeng Qiu
2016-10-25 21:46   ` John Wiegley
2016-10-26  1:46     ` Junpeng Qiu

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).