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: PEG Parser Date: Thu, 27 Jan 2011 23:13:39 -0600 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 1296203636 29442 80.91.229.12 (28 Jan 2011 08:33:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 28 Jan 2011 08:33:56 +0000 (UTC) Cc: =?ISO-8859-1?Q?Ludovic_Court=E8s?= , guile-devel@gnu.org To: Noah Lavine Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jan 28 09:33:51 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 1Pijm8-0004g9-5b for guile-devel@m.gmane.org; Fri, 28 Jan 2011 09:33:48 +0100 Original-Received: from localhost ([127.0.0.1]:44918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PijkM-000390-Va for guile-devel@m.gmane.org; Fri, 28 Jan 2011 03:31:59 -0500 Original-Received: from [140.186.70.92] (port=44504 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PijAI-0002tL-NK for guile-devel@gnu.org; Fri, 28 Jan 2011 02:54:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PijAH-0008SI-IJ for guile-devel@gnu.org; Fri, 28 Jan 2011 02:54:42 -0500 Original-Received: from mail-gy0-f169.google.com ([209.85.160.169]:60407) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PijAH-0008SB-FT; Fri, 28 Jan 2011 02:54:41 -0500 Original-Received: by gyd10 with SMTP id 10so1216471gyd.0 for ; Thu, 27 Jan 2011 23:54:41 -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:from :date:x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Z7wlVzE8LpIYs50wgu+LndGlDBK9mFGuplZ3zLr6G9Q=; b=lq76ybCuJragoYVdcwpBRlOhQUcieGw67TAEeHSApb1rhmYGxx5FUkahJ28WUWQAcL Zq+Kpr74mmyL4HY/za+XBuq1S/XSDnGFna4n5E6KQQOtxhy4nD00KFN4QOwO/Fk1xjfA JE6Tpv10bEv7qThODKLEP7uH+IJ9AROyF7rFs= 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=YGJoTgmz0Y0j0GZWN3gR/Sy3iQJoewZcOZLrFQflrAN6rmgrTijb/R50p310Afqinz mMxPM7BxEecW2PYMJhEU4QnyzIDYldPR7nt0HM85+c9AiHVU3F0ZmPX3uE4LuT3HHT1X 7LCnq5KtcTYKLZtzpLW8/9nKRzNyLVqn93o88= Original-Received: by 10.150.96.1 with SMTP id t1mr2011821ybb.37.1296191639947; Thu, 27 Jan 2011 21:13:59 -0800 (PST) Original-Received: by 10.151.43.6 with HTTP; Thu, 27 Jan 2011 21:13:39 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: 40FRNywacMWwKkouOLrU06uiUrA X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.160.169 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:11368 Archived-At: Putting it in single quotes should work. E.g. " '[' ". Similarly, you can add a literal single quote by making it part of a character class. E.g. " ['] ". You're right, I should definitely add something about that to the documenta= tion. Any other weak parts you've noticed while perusing? On Thu, Jan 27, 2011 at 9:25 PM, Noah Lavine wrot= e: > Hello again, > > I've run into another issue with the parser that should be addressed > in the documentation (or the code?). > > How do you match a character that is used in the PEG grammar, like > "["? Can you only define such matchers via s-expressions? > > Noah > > On Thu, Jan 27, 2011 at 12:17 AM, Noah Lavine w= rote: >> Hi, >> >>> It flattens until you have a list where each element either: >>> 1. Is an atom. >>> or 2. Is a list whose first element is in the list of keywords. >>> >>> So the car of the argument will change if it's a list that doesn't >>> start with the right keyword. =A0E.g.: >>> (keyword-flatten '(a) '((c (a b)) (a b) (b a))) -> >>> (c (a b) (a b) b a) >> >> I see. >> >>> That's odd. =A0Could you paste in the lambda expression it generates? >> >> Wait, actually, I realized it was my own error. My test function was >> using nonterminals, but I had only done (define grammar-string ....), >> not (define-grammar grammar-string). I think the generated code tried >> to call the nonterminals that should have been there, and threw an >> error when it didn't find them. >> >> The peg matcher is really awesome. I am glad to be able to use it soon. >> >> Noah >> >