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: Mon, 5 Jul 2010 18:59:33 -0500 Message-ID: References: <874ogdmu2m.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1278374411 4259 80.91.229.12 (6 Jul 2010 00:00:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 6 Jul 2010 00:00:11 +0000 (UTC) Cc: guile-devel@gnu.org To: =?ISO-8859-1?Q?Ludovic_Court=E8s?= Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jul 06 02:00:10 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 1OVva3-0004kf-6s for guile-devel@m.gmane.org; Tue, 06 Jul 2010 02:00:07 +0200 Original-Received: from localhost ([127.0.0.1]:48918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVva2-0002CB-4V for guile-devel@m.gmane.org; Mon, 05 Jul 2010 20:00:06 -0400 Original-Received: from [140.186.70.92] (port=55710 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVvZs-0002AX-Kp for guile-devel@gnu.org; Mon, 05 Jul 2010 19:59:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OVvZq-0004uD-D4 for guile-devel@gnu.org; Mon, 05 Jul 2010 19:59:56 -0400 Original-Received: from mail-vw0-f41.google.com ([209.85.212.41]:44405) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVvZq-0004u3-8E; Mon, 05 Jul 2010 19:59:54 -0400 Original-Received: by vws1 with SMTP id 1so7326545vws.0 for ; Mon, 05 Jul 2010 16:59:53 -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=v7/8cZ1NlXhAHeejosPmqaxCJgUWpcwmIixwGJaeMUk=; b=RhwhgC75joBhwJLpqdRjGlMDNbgabpWzkjlhMmGLezAFRJO67y2jVwivFeBOEOgUFG X9lUBW+OeVC4drO2z4BMyWEPaenaul3gqpxHqYFnNe3jc/KIHxHx2yeMc4inm0E55ch3 WrGAeg3rbxYLvUUvVHXcwESWdYaVuyjXu82EE= 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=jUYyC5KJAQKxbqIHFweQLDYvSch2dxfMFbxS5Ti6314tddga+/G0LD1+gBteGCGbVa VrN0DCyEiZw4XRrPkqBtGgi5RItyVmhQGqTItyKlxLkBDh6KAtASBtdhFLTvbFylTvfW DDlNbOxJPJe6+teVMhosL0Nl53KvU+mCg6oKE= Original-Received: by 10.220.123.33 with SMTP id n33mr1977102vcr.64.1278374393135; Mon, 05 Jul 2010 16:59:53 -0700 (PDT) Original-Received: by 10.220.94.70 with HTTP; Mon, 5 Jul 2010 16:59:33 -0700 (PDT) In-Reply-To: <874ogdmu2m.fsf@gnu.org> X-Google-Sender-Auth: _e_3LHz_rytRJ2w622FB7wQH4Oc 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:10617 Archived-At: On Mon, Jul 5, 2010 at 5:40 PM, Ludovic Court=E8s wrote: > Hi! > > Thanks for the status report! > > Michael Lucy writes: > >> Files I've added so far: >> guile/modules/ice-9/peg.scm (I assume this is the right place to put thi= s?) > > No, it should rather go under =91module/language/peg.scm=92, for the sake= of > consistency with other compiler front-ends. =A0But see below. I'm not quite sure how this qualifies as a compiler front-end. The functionality is mostly done (if unoptimized), so it shouldn't be too hard to turn it into one if that's what you want, but the original thought was just to build a compiling parser. E.g.: (use-modules (ice-9 peg)) (peg-find "'b'+" "aabbcc") --> (2 4 "bb") It does this by compiling "'b'+" into a lambda expression that then gets called on whatever the second argument is (the compilation is done at read-time). So after macro-expansion, you have something like: ((lambda (...) ...) "aabbcc" ...) I was thinking of this as a sort of alternative to regular expressions that also does parsing, and I noticed the regular expressions module was in ice-9, so I put it there. Are you saying that the functionality that compiles "'b'+" to a lambda expression should be broken out into a language module that instead compiles it to TREE-IL code? Am I fundamentally misunderstanding something? > >> PEG compiler: Works for all the grammars I've tested, no known bugs. >> Currently compiles to Scheme code rather than Tree-IL for debugging. > > It should rather compiler to tree-IL, like other front-ends, which is > very close to Scheme anyway. Alright, I'll fix that. Noob question: The only way I can figure out to compile tree-il code is the rather ugly: (compile (parse-tree-il '(code here)) #:from 'tree-il) Is there a better way? > >> 2. Tests aren't standardized (peg.test looks nothing like the other >> .test files). > > Well, you know what to do then. =A0;-) > >> 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? > > Actually it doesn=92t work. =A0Try: It can definitely use the functions: " ~/guile-git/tst/guile/meta $ ./guile GNU Guile 1.9.11.154-b1066 Copyright (C) 1995-2010 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (use-modules (ice-9 peg)) ;;; note: autocompilation is enabled, set GUILE_AUTO_COMPILE=3D0 ;;; or pass the --no-autocompile argument to disable. ;;; compiling /home/zededarian/guile-git/tst/guile/module/ice-9/peg.scm ;;; WARNING: compilation of /home/zededarian/guile-git/tst/guile/module/ice-9/peg.scm failed: ;;; key wrong-type-arg, throw args ("vm-debug-engine" "Wrong type to apply: ~S" (#f) (#f)) scheme@(guile-user)> (peg-find "'b'+" "aabbcc") (2 4 "bb") scheme@(guile-user)> " And when I use it with --no-autocompile I don't get any errors: " ~/guile-git/tst/guile/meta $ ./guile --no-autocompile GNU Guile 1.9.11.154-b1066 Copyright (C) 1995-2010 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (use-modules (ice-9 peg)) scheme@(guile-user)> (peg-find "'b'+" "aabbcc") (2 4 "bb") scheme@(guile-user)> " What does this mean? > > =A0$ ./meta/guile --no-autocompile > =A0> (use-modules (ice-9 peg)) > > It should trigger the debugger from where you can get a backtrace. > > Thanks, > Ludo=92. > > > Thanks.