From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Junpeng Qiu Newsgroups: gmane.emacs.devel Subject: [ELPA] New package: parsec Date: Tue, 25 Oct 2016 16:17:29 -0400 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bf0bfd4dde9b1053fb63352 X-Trace: blaine.gmane.org 1477426723 10166 195.159.176.226 (25 Oct 2016 20:18:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Oct 2016 20:18:43 +0000 (UTC) Cc: Stefan Monnier To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 25 22:18:39 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bz8B2-0000rr-1x for ged-emacs-devel@m.gmane.org; Tue, 25 Oct 2016 22:18:28 +0200 Original-Received: from localhost ([::1]:58033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz8B4-0003b2-2G for ged-emacs-devel@m.gmane.org; Tue, 25 Oct 2016 16:18:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz8AT-0003av-I2 for emacs-devel@gnu.org; Tue, 25 Oct 2016 16:17:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz8AS-0005cA-AH for emacs-devel@gnu.org; Tue, 25 Oct 2016 16:17:53 -0400 Original-Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:37128) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bz8AS-0005bv-2d for emacs-devel@gnu.org; Tue, 25 Oct 2016 16:17:52 -0400 Original-Received: by mail-wm0-x235.google.com with SMTP id c78so45262237wme.0 for ; Tue, 25 Oct 2016 13:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc; bh=LtJ5+/29slZLHit2tU8bvZ5nOEzxfTH/hz7pGG9hosg=; b=JK714DlrlmejWM82z/vjHc4i7KF4R2LBN51M1tsg14BWgjK5ujK4+2xdjt/PMytzbm fC+UGNTiPcIh4S591FhZnSzi/htJodfu0z4bPOLa6RMS+MeYO5GIk4YScgH3NMx7yqdZ vvdHfztVtp/qZFVUCkl4d8zkqqnMKoVCgAHqhrnL6STmCOu26XoA7kgaVtpB0kvdEM6q 321tb+XTS5XcobH4+6Kv6DCvgys90OFEmIUS2Ki2JcV9eOoqoq7Zol4o2fC2CXiO0hAL mBjLclmTrl1jmjGrUl0qRL1HQ5X9Doc4an13B/38LQZSJCw5OA9ZW0gcN5GiP0WMuMsW 5Dqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=LtJ5+/29slZLHit2tU8bvZ5nOEzxfTH/hz7pGG9hosg=; b=BB2Uc2068z2iPh+OVZPLYW/ljiWNolWw0pArFq+iw0lRdVCOZrdhNvS4rSx6YEZycQ D9B0Hu2I9HczTGBS2x/HPGLsA9FJJTYisJIDVfE+Q06eVXIVpFKncba4Qh0Toh70xdnu siLaC9yyb1SzrIE+vQ8D7zOtXtBjtxN9etXPF4NwvCywtahMavuArGMjVyXhJFbr6Fq0 fov2skdOFWwwzDDoE7rvilNra1YBLajK5GL2GJ4uiKlrbqqd8MAq9zfIFSSDtNF/7Hrf k6+dQQOeyoMXH6SQmWBhXabgxc+NsxKvhZwLgxSvRSdAjXZg0zmf1dDPrk5UrkfGfjCI sT3A== X-Gm-Message-State: ABUngvcY2XF8T83RoWuP/Q0QWNoCdEcLAqgWKv/qV/N9ulbUlSfKmckNf+4Z9vIyg73W4l0xT9bIpjcEO6W5Zw== X-Received: by 10.194.82.100 with SMTP id h4mr18096958wjy.183.1477426670330; Tue, 25 Oct 2016 13:17:50 -0700 (PDT) Original-Received: by 10.28.69.133 with HTTP; Tue, 25 Oct 2016 13:17:29 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:208803 Archived-At: --047d7bf0bfd4dde9b1053fb63352 Content-Type: text/plain; charset=UTF-8 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 --047d7bf0bfd4dde9b1053fb63352 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello Emacs,

I'v= e added a new package "parsec" to GNU ELPA (hoping I've not m= essed up anything). This is a parser combinator library for Emacs Lisp, sim= ilar 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/par= sec.el.

John's [emacs-pl] is awesome, but I found fol= lowing problems when I tried to use it:
- it only contains a very limite= d set of combinators
- Some of its functions (combinators) have differen= t behaviors than their Haskell counterparts
- It can't show error me= ssages when parsing fails.

The new library, parsec, con= tains 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 bac= kground 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 i= t here. Parsec also comes with a simple error handling mechanism, which may= be improved in the future.

To give a short example, the follo= wing code extract the "hello" from the comment:

=C2=A0 (pa= rsec-with-input "/* hello */"
=C2=A0=C2=A0=C2=A0 (parsec-strin= g "/*")
=C2=A0=C2=A0=C2=A0 (parsec-many-till-as-string (parsec= -any-ch)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (parsec-try
=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (parsec-string "*/"))))

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