From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: GSOC PEG project Date: Thu, 08 Jul 2010 11:29:33 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1278587495 6090 80.91.229.12 (8 Jul 2010 11:11:35 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 8 Jul 2010 11:11:35 +0000 (UTC) Cc: guile-devel@gnu.org To: Michael Lucy Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 08 13:11:31 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 1OWp0s-0004kE-Hw for guile-devel@m.gmane.org; Thu, 08 Jul 2010 13:11:31 +0200 Original-Received: from localhost ([127.0.0.1]:39616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWp0r-0006Ar-Db for guile-devel@m.gmane.org; Thu, 08 Jul 2010 07:11:29 -0400 Original-Received: from [140.186.70.92] (port=39252 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWp0m-00069E-SG for guile-devel@gnu.org; Thu, 08 Jul 2010 07:11:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWp0k-00039g-Eu for guile-devel@gnu.org; Thu, 08 Jul 2010 07:11:24 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:47791 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWp0k-000368-CR for guile-devel@gnu.org; Thu, 08 Jul 2010 07:11:22 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 57642C1C34; Thu, 8 Jul 2010 07:10:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=JpiPnVEup9+6BmHGUTScvDsHns0=; b=h+seSc AQYPwz0xBOCZLfrpAB1jhVdC81AchkUGWSh6YyRTdU8ET7r5ap/54lzldOKB5BzC gL3bvnB0kMfmgV4wMyM6JTm7k+i1b0Xcv320yJwvKKyMNb2LwjIMDKQEmqBp+AdE ScsG/pWDqTRbdW+TUb0VMcZIj2STSnqBnG8No= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=dWYp6C/Tmh82xwLZgBJAuJZ2LLrkUOA6 Bo3uVnUMLtnH/2SMYfAfg3MXBM6kWm5M1VnAkIhyCIkfdsjEtQVK4x1tc7bF6XNS f/iQRxHnQOaoSoWH4B0hnCCUeQi3REmVM67vIaM0kQaE+WL0i9ZPZ+yKZQgtuV4G Zf01dZfjwnI= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 435D7C1C33; Thu, 8 Jul 2010 07:10:54 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [81.253.44.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id A997BC1C31; Thu, 8 Jul 2010 07:10:52 -0400 (EDT) In-Reply-To: (Michael Lucy's message of "Mon, 5 Jul 2010 01:05:52 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 79C0B294-8A81-11DF-8C88-9056EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:10627 Archived-At: 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 this?) 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. > Syntactic Sugar: Canonical string-based PEGs can be parsed just fine. Cool! > Testing: Small test suite. Needs to be standardized with the other .test 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. I've been > meaning to ask, how big a deal is this? I originally had it compile > to Scheme while I was debugging things, but the Scheme gets compiled > down to TREE-IL form, right? Should 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. > 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 > ;;; newer than compiled > /home/zededarian/guile/cache/guile/ccache/2.0-0.R-LE-4/home/zededarian/guile/module/ice-9/peg.scm.go > ;;; note: autocompilation is enabled, set GUILE_AUTO_COMPILE=0 > ;;; 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. Can anybody shed light on > what this means? Dunno! We'll look at it after getting the macro situation sorted out. You can try: (use-modules (system base compile)) (compile-file "module/ice-9/peg.scm") and see where the debugger leaves you. > 5. The pretty-print module doesn't get loaded when peg does, and some > of my functions use it. I 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? I'm sorry I didn't get this into a branch earlier. Heh, no problem. I'm looking forward to a lean mean PEG parsing machine! Andy -- http://wingolog.org/