From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Thompson, David" Newsgroups: gmane.lisp.guile.user Subject: Re: Getting started with Guile Parser Combinators Date: Mon, 20 Jun 2016 13:34:12 -0400 Message-ID: References: <88f16bd80cfb591811c79ca507b7fb5b@hypermove.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1466445279 31865 80.91.229.3 (20 Jun 2016 17:54:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2016 17:54:39 +0000 (UTC) Cc: Guile User To: Amirouche Boubekki Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jun 20 19:54:34 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bF3On-0006Jx-Hg for guile-user@m.gmane.org; Mon, 20 Jun 2016 19:54:13 +0200 Original-Received: from localhost ([::1]:45395 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF3Om-0006Lt-SZ for guile-user@m.gmane.org; Mon, 20 Jun 2016 13:54:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF35T-0004iS-2d for guile-user@gnu.org; Mon, 20 Jun 2016 13:34:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF35R-0001de-Qd for guile-user@gnu.org; Mon, 20 Jun 2016 13:34:15 -0400 Original-Received: from mail-vk0-x22d.google.com ([2607:f8b0:400c:c05::22d]:36210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF35R-0001dY-Lq for guile-user@gnu.org; Mon, 20 Jun 2016 13:34:13 -0400 Original-Received: by mail-vk0-x22d.google.com with SMTP id u64so204743176vkf.3 for ; Mon, 20 Jun 2016 10:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=worcester-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-transfer-encoding; bh=ASKaAv+dwob09asFSJM4Lud46uYq53qQF8D/Ll2u2RY=; b=V5MJEjVRbsKvoVyqFmNYEtQAYdRM0MN+OixVX82lCCpupN8Vh/wA8iw00tipiNnkGB fSRbmOZI6pz4gyz73M5im8XEebZ/s3FX9RDH+BKf4cwNs8DpTwsYI+rnOIwmzTg2MZVs dPH/ZLYsNoeQpktD+tEYNN/MH87C5FUuPVCL1kqP5frHD2bw0FTXSEVXTp/qVNB5sAE7 SnJ00cgJnlx8rWP4IoAJyBVR1ePCLYahUK30phvdqweYITFIFnci4ZVtmCcwu4e5V4CF h6UmSYgNcBaK+G3OiZY1vlIbvgilwrY/ZQVGCfsQZAOaOrPztgQbQiP+f4AeQAfUmyID bW7w== 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:date :message-id:subject:from:to:cc:content-transfer-encoding; bh=ASKaAv+dwob09asFSJM4Lud46uYq53qQF8D/Ll2u2RY=; b=McRSQ9ZMIsPHXE6N/wKM0e/XPaYY538cYRHHutEqKjskCz73BmzguxE6RATlIVEyVC eXWHrSWA6C56PpueKl0cvxmM3gVBDHfwm3AciK4slVDJlF7Ykzbdf7DU/yqrPzPOgaBC WBQ+Q7UYkTfv6JmDEx7GD3rPxu8HTspIfxm07GOU7ub4zrOhb0PYN+4fHY09gJOv67+S jJtygrocoMb99rUnY9Lzi3VTap2YpEhzbJIr/XEIStMmT/EbwNSny5UJ0Ca3ObsX255W 9jC8WouSMf4uWdMXBgLmsZVYm7/qtNzt+MxgktOKj5jleoYyQ7/OvbShwBqaXWHCXjsf zEVg== X-Gm-Message-State: ALyK8tKNRXatH8Xyav+gJ7RWwwy+13M9G5E13pa08QzltU9KvkgLd1tgZi57U9XlvAm/5NwixCCXplbEo9Weo6j9 X-Received: by 10.31.178.18 with SMTP id b18mr7557203vkf.84.1466444053061; Mon, 20 Jun 2016 10:34:13 -0700 (PDT) Original-Received: by 10.31.153.141 with HTTP; Mon, 20 Jun 2016 10:34:12 -0700 (PDT) In-Reply-To: <88f16bd80cfb591811c79ca507b7fb5b@hypermove.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c05::22d X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12667 Archived-At: On Sun, Jun 19, 2016 at 2:57 PM, Amirouche Boubekki wrote: > H=C3=A9llo, > > > There is an implementation of guile parser combinators available here [1]= . > > Here's my attempt at explaining how it works: > > http://hyperdev.fr/notes/getting-started-with-guile-parser-combinators.ht= ml This was lovely, thanks! Glad to see someone using my parser combinator library. Knowing that someone is actually using this library makes me a bit embarrassed about its naive implementation. I said some of these things on IRC, but I'd like to list some desired future improvements here too in the hope that maybe some interested hackers will read it and jump in to help: - Stop using SRFI-41 streams. It's very elegant, but wrapping each character in a stream-pair is inefficient. In order to replace it, we need another abstraction around a port that allows for backtracking across the entire text without all of the allocation. - Temporarily memoize parse results. It happens often enough that the same parser will be used on the same character of the stream, so memoization would improve performance. The usual memoize implementation uses a hash table that will not be GC'd as long as the procedure is alive. This unbounded memory growth would be a big problem for a parsing library, so it would be better if the hash table could be cleared once parsing a file has completed. - Unlock GLL parsing abilities. With some control-flow hackery[0], it is possible to handle left-recursive grammars without entering an infinite loop. Would be cool to have this ability while also preserving the purely functional semantics of the current design. - Dave [0] https://github.com/epsil/gll#continuation-passing-style