From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Lucy Newsgroups: gmane.lisp.guile.devel Subject: Re: GSOC PEG project Date: Fri, 9 Jul 2010 02:58:05 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1278662319 7773 80.91.229.12 (9 Jul 2010 07:58:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Jul 2010 07:58:39 +0000 (UTC) Cc: guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jul 09 09:58:37 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OX8Tj-0008NV-Mi for guile-devel@m.gmane.org; Fri, 09 Jul 2010 09:58:36 +0200 Original-Received: from localhost ([127.0.0.1]:44516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OX8Tg-0001eN-Im for guile-devel@m.gmane.org; Fri, 09 Jul 2010 03:58:32 -0400 Original-Received: from [140.186.70.92] (port=46672 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OX8Tc-0001cs-2N for guile-devel@gnu.org; Fri, 09 Jul 2010 03:58:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OX8Ta-00022V-Fx for guile-devel@gnu.org; Fri, 09 Jul 2010 03:58:27 -0400 Original-Received: from mail-vw0-f41.google.com ([209.85.212.41]:43144) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OX8Ta-00022K-AZ for guile-devel@gnu.org; Fri, 09 Jul 2010 03:58:26 -0400 Original-Received: by vws1 with SMTP id 1so201462vws.0 for ; Fri, 09 Jul 2010 00:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=j+7zgOqS1mznfg09O1qr0pdSUVC5qxOsH/KDCDhISPg=; b=OAaCdYS6KHcMEK+WjsEi/Eq4zCFQYYxVJFxjCTTUZiDiUHMguTdaWdIFzycZeRKA4f thULtTH1+J194TciN/hyrOPSlOKzMqB+OUQ0OpRN+kJZVEsTAErsdQRqI0nXxGkHiYDA YVbsC/goW7DerKZLJOmPMaHwOfh38ze3J6Mr4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=lNMbkwpxW9Z4IBZzAa5DPQ6ituFu+udPY1lHXMJvbsXcCcW4Wo7kTdm8szQ/0SKTiO DiKLEqDQueaAJVXL2VKXxMO4+TsjPD0nH4WilJuoRc/ZtECZNSyNcCnFn/OUydfE22R3 6jMIeAOSeXUQU5hvc2a93CF6Hz7nxwQFpNXUg= Original-Received: by 10.220.128.196 with SMTP id l4mr5004401vcs.174.1278662305226; Fri, 09 Jul 2010 00:58:25 -0700 (PDT) Original-Received: by 10.220.94.70 with HTTP; Fri, 9 Jul 2010 00:58:05 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: giFiv2BHPCLW9kRT6EBwB3M3k30 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10632 Archived-At: On Thu, Jul 8, 2010 at 5:29 AM, Andy Wingo wrote: > Hi Michael, > > I am travelling currently, so a bit of asynchronicity in the reply :) > > On Mon 05 Jul 2010 07:05, Michael Lucy writes: > >> I finally got things into a usable state, so I pushed out what I have >> to origin/mlucy. > > Great news! > >> Files I've added so far: >> guile/modules/ice-9/peg.scm (I assume this is the right place to put thi= s?) > > Probably, yes, for parts of PEG to be available as macros and > procedures. You would probably want a language implementation as well, > for string-based PEGs. > >> PEG compiler: Works for all the grammars I've tested, no known bugs. >> Currently compiles to Scheme code rather than Tree-IL for debugging. > > That is the right thing to do. Most of PEG should be available through > macros and procedures. > >> Comments: Pretty good I think, but I could stand to have more. > > Yes, it readable at a quick glance. > >> External documentation: None so far. > > A .texi file will be good, alongside the LALR(1) parser. Working on this now; should be done soon. > >> Syntactic Sugar: Canonical string-based PEGs can be parsed just fine. > > Cool! > >> Testing: Small test suite. =A0Needs to be standardized with the other .t= est files. > > Great. > >> Benchmarks: None so far, but I haven't really done any optimization so >> I'd bet it performs poorly. > > Well, it's good to have work left to do :) > >> Problems: >> >> 1. PEG compiler compiles to scheme code rather than TREE-IL, and uses >> some custom pieces of syntax that I then have to export. =A0I've been >> meaning to ask, how big a deal is this? =A0I originally had it compile >> to Scheme while I was debugging things, but the Scheme gets compiled >> down to TREE-IL form, right? =A0Should I fix it to compile straight to >> TREE-IL anyway rather than just finding a way to get around having to >> export all that syntax? > > No it should compile to Scheme. However the biggest problem with your > code is that it is implemented with define-macro. You should change it > to be implemented with syntax-case. Please let me know if you need help. > > Syntax-case is a bit trickier in some ways than define-macro, but it's > simpler in others (e.g., no need for your `safe-bind' macro). Check out > "Macros" in the manual (from git) and tell me what's confusing there; it > was only fleshed out with info on syntax-case recently. The documentation looks pretty straightforward. This will probably take me a bit; some of the translations look a little complicated. This will also solve my current problem of having to export a bunch of macros for the compiled PEGs to work. I've been thinking it might be good to work on the benchmarks first--once I understand where the speed bottlenecks are I'll have to rewrite some of the macros anyway, and it would probably be easier to rewrite them as syntax-case macros then instead of doing it twice. If you'd rather I translate them first, though, I'm happy to. Sorry I didn't do it this way in the first place. > >> 2. Tests aren't standardized (peg.test looks nothing like the other >> .test files). > > This isn't a big deal > >> 3. This: >> >> scheme@(guile-user)> (use-modules (ice-9 peg)) >> ;;; note: source file /home/zededarian/guile/module/ice-9/peg.scm >> ;;; =A0 =A0 =A0 newer than compiled >> /home/zededarian/guile/cache/guile/ccache/2.0-0.R-LE-4/home/zededarian/g= uile/module/ice-9/peg.scm.go >> ;;; note: autocompilation is enabled, set GUILE_AUTO_COMPILE=3D0 >> ;;; =A0 =A0 =A0 or pass the --no-autocompile argument to disable. >> ;;; compiling /home/zededarian/guile/module/ice-9/peg.scm >> ;;; WARNING: compilation of /home/zededarian/guile/module/ice-9/peg.scm = failed: >> ;;; key wrong-type-arg, throw args ("vm-debug-engine" "Wrong type to >> apply: ~S" (#f) (#f)) >> >> Somehow it works fine despite the warnings. =A0Can anybody shed light on >> what this means? > > Dunno! We'll look at it after getting the macro situation sorted > out. You can try: > > =A0(use-modules (system base compile)) > =A0(compile-file "module/ice-9/peg.scm") > > and see where the debugger leaves you. Turns out I can fix this by wrapping my entire file in an (eval-when (compile load eval) ...) form. Is this one of those fixes that's going to haunt me down the line? > >> 5. The pretty-print module doesn't get loaded when peg does, and some >> of my functions use it. =A0I have: >> >> :use-module (ice-9 pretty-print) >> >> in my define-module form at the top of peg.scm; shouldn't that take >> care of it? > > Yep, that should work. > >> Any thoughts or comments? =A0I'm sorry I didn't get this into a branch e= arlier. > > Heh, no problem. I'm looking forward to a lean mean PEG parsing machine! > > Andy > -- > http://wingolog.org/ >