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: Re: [ELPA] New package: parsec Date: Tue, 25 Oct 2016 16:23:42 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bf0bfd4172cbe053fb64adc X-Trace: blaine.gmane.org 1477427147 6573 195.159.176.226 (25 Oct 2016 20:25:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Oct 2016 20:25:47 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 25 22:25:43 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 1bz8Hk-0007R5-Mc for ged-emacs-devel@m.gmane.org; Tue, 25 Oct 2016 22:25:24 +0200 Original-Received: from localhost ([::1]:58047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz8Hn-0004va-2z for ged-emacs-devel@m.gmane.org; Tue, 25 Oct 2016 16:25:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz8GX-0004W6-HK for emacs-devel@gnu.org; Tue, 25 Oct 2016 16:24:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz8GS-0007Cx-QZ for emacs-devel@gnu.org; Tue, 25 Oct 2016 16:24:09 -0400 Original-Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:38104) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bz8GS-0007Cr-Hy for emacs-devel@gnu.org; Tue, 25 Oct 2016 16:24:04 -0400 Original-Received: by mail-wm0-x234.google.com with SMTP id d128so48326119wmf.1 for ; Tue, 25 Oct 2016 13:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=C/dgZIFEKe9fHkmvbxtcPX7eJON8qIxkZG3U6bCdrLo=; b=JVNgq7+c9pRAONU4pcY6FC9GhJq0+Q0MzTGZN/L6vLagKLGNWfyUWYrhKDWAsLjdnR ho8/rlZZ7InI6B6Ykpm7oFjmUlcug+YDkG/2aR+I5PNGouQDyyOw4xTj0rcKMuq+dgqW W0i6pwjy/gAmy399Y0Jm/3KzY1ooAuKmmfLC6zLv6xgZB3YRZy0dL1Sr/vCEWshjIobZ 3Yij6b6kpnfZty3BEu4x0gSA0IR8s3KRXdhggcBwYkl1sEXON7QHz5eTOYzLRqMAyBe3 p0IyX2SP+b06/TX6wIWu+8PY21AkKgFOYbsoLuVa+pkSWjgmIrAh/5KPmAmY4qqbzQmB UrbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=C/dgZIFEKe9fHkmvbxtcPX7eJON8qIxkZG3U6bCdrLo=; b=NRtTHhORZduFyYCzU16XBP/6i2FVFSGa2BbpNgsd2rwT7SEuQsA5JO4FxVaGGEGbt1 P9lNpZA7KasSBAnM3YWSN07uVGp4puE+fEAx613c0gaxSggvnvFHRvJKj/eg8TFV+qRY Kv2hwlvyim3EM2vNzUh8GY4WWsPMq94y98Hf9Sqivw6wH9uUOIguVybG7e/HHRywlhd7 yUXNtA4/E+0E0Y3lpxxSEZ/YVF1sYZKutU1klFC+g/q01NyBq1MqvFwTAFL/TEBRZF/s lpRkbGpDsz8GfRJqYSFrB8loTNH2btk80znNkD3T8h1NDHXIQ6pzBUNhj3KlqERmS+9K FHlQ== X-Gm-Message-State: ABUngvfw+4eyTUC1hwmzJSQuMxxHp7LUVgX+DGQ+qzUF7E55bzcWlFeEjRnPvZSOXJCjjfM0mZl8JtPgtFhCVA== X-Received: by 10.194.82.100 with SMTP id h4mr18114350wjy.183.1477427043182; Tue, 25 Oct 2016 13:24:03 -0700 (PDT) Original-Received: by 10.28.69.133 with HTTP; Tue, 25 Oct 2016 13:23:42 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::234 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:208804 Archived-At: --047d7bf0bfd4172cbe053fb64adc Content-Type: text/plain; charset=UTF-8 Sorry. I seemed to paste the wrong URL for John's emacs-pl. Here you go: [emacs-pl]: https://github.com/jwiegley/emacs-pl Thanks, -Junpeng On Tue, Oct 25, 2016 at 4:17 PM, Junpeng Qiu wrote: > 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 > --047d7bf0bfd4172cbe053fb64adc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Sorry. I seemed to paste the wrong URL for = John's emacs-pl. Here you go:

[emacs-pl]: https://github.com/jwiegley/emacs-pl
Thanks,
-Junpeng
<= br>
On Tue, Oct 25, 2016 at 4:17 PM, Junpeng Qiu = <qjpchmail@gmail.com> wrote:
Hello Emacs,

I&= #39;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 [emac= s-pl]. The main repo of parsec is on GitHub: https://github.com/cute-jumper/parsec.el.

John's [emacs-pl] is awesome, but I foun= d following problems when I tried to use it:
- it only contains a very l= imited set of combinators
- Some of its functions (combinators) have dif= ferent behaviors than their Haskell counterparts
- It can't show err= or messages when parsing fails.

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

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

=C2= =A0 (parsec-with-input "/* hello */"
=C2=A0=C2=A0=C2=A0 (parse= c-string "/*")
=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<= br>=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 "*/&= quot;))))

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

Thanks,
-Junpen= g

--047d7bf0bfd4172cbe053fb64adc--