From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Re: PEG Parser Date: Wed, 26 Jan 2011 21:38:22 -0500 Message-ID: References: <87bp3fi5cp.fsf@gnu.org> <87aaisr6sn.fsf@gnu.org> 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 1296095925 21408 80.91.229.12 (27 Jan 2011 02:38:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 27 Jan 2011 02:38:45 +0000 (UTC) Cc: =?ISO-8859-1?Q?Ludovic_Court=E8s?= , guile-devel@gnu.org To: Michael Lucy Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jan 27 03:38:41 2011 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 1PiHkn-0000eh-N1 for guile-devel@m.gmane.org; Thu, 27 Jan 2011 03:38:40 +0100 Original-Received: from localhost ([127.0.0.1]:59791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiHki-0000wr-PV for guile-devel@m.gmane.org; Wed, 26 Jan 2011 21:38:28 -0500 Original-Received: from [140.186.70.92] (port=42627 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiHkg-0000w0-0A for guile-devel@gnu.org; Wed, 26 Jan 2011 21:38:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiHke-0000X9-6E for guile-devel@gnu.org; Wed, 26 Jan 2011 21:38:25 -0500 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:64205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiHke-0000X5-0z; Wed, 26 Jan 2011 21:38:24 -0500 Original-Received: by yxl31 with SMTP id 31so487380yxl.0 for ; Wed, 26 Jan 2011 18:38:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=XOzh9gzCWbP2sm/N/ta8PbUBO7dDWLDAwa2z1qN7A6k=; b=UUtayEIEN7ymjihnweZXT1fnpA2oc+04qjiCpVpWzqd0pWm272cykVTUcDrMqpm+OQ 2yxXg+NBq4SyovBf5/95KzqRzExK32Xmo3JuncS+CP0tVA+cSeaOSFWUKOYKCC9rf4Vh LIyGbTGpHelQ4DNw25MK1MisX3X3T+2CyIBnw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=yIZVNYF9TaFliLgxfAIRGZbH+XlpZsDbbAyyuNc8fZ1LbJYlhOtoH/jJwlYAhXX6PZ xKp96yxxskAPBBRhznR6mprIy3Y/bguyT0X3ZaTaOE0FuG6UPwBfMSddMD5/vXXtO7B0 rMsiYYrimyUwWWv8D5KIsbIYf/g18ByEWkgrk= Original-Received: by 10.150.229.11 with SMTP id b11mr868139ybh.303.1296095903021; Wed, 26 Jan 2011 18:38:23 -0800 (PST) Original-Received: by 10.147.32.7 with HTTP; Wed, 26 Jan 2011 18:38:22 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: NWjt02sYrGSWbaJ1C1Acn6iUV0o 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:11352 Archived-At: Hello, > I'm the guy that originally wrote this for GSOC, so I figured I'd jump > in. =A0I'd be happy to help with getting the PEG module merge-ready. Great! > keyword-flatten is described in api-peg.texi. =A0It's basically a > special case of context-flatten which collapses S-expressions > according to the symbol they start with. =A0From the documentation: > @deffn {Scheme Procedure} keyword-flatten terms lst > A less general form of @code{context-flatten}. Takes a list of > terminal atoms @code{terms} and flattens @var{lst} until all elements > are either atoms, or lists which have an atom from @code{terms} as > their first element. > @lisp > (keyword-flatten '(a b) '(c a b (a c) (b c) (c (b a) (c a)))) @result{} > (c a b (a c) (b c) c (b a) c a) > @end lisp Okay. I was confused about the behavior of keyword-flatten when the car of its argument is not in its list of keywords. I expected that to change, but it didn't. Looking at it now, is it true that the car of the argument never changes? So keyword-flatten flattens the sublists, but has to leave the overall one alone? > peg-string-compile is a function that will compile PEGs expressed as > strings into lambda expressions. =A0It does this by first parsing the > string using the PEG-parsing-PEG, then turning the output into an > S-expression representation of a PEG, compressing it, and passing the > compressed S-expression to peg-sexp-compile. =A0It's used if you e.g. > call peg-match with a string instead of an S-expression as the first > argument. I tried running peg-string-compile and then passing the result to eval, but I got an error because there was no symbol 'Begin. (capital B intended) Do you know what's going on with that? It might be something weird involving memoized symbols. Also, just to make sure I get it - this function produces Scheme code, right? (As opposed to Tree-IL or any of Guile's other languages.) Noah