Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion segment matching variables in Qi-YACC (for Snorgers ;))

View Parsed - Show only message text

MIME-Version: 1.0
Received: by 10.151.133.13 with SMTP id k13mr35059ybn.11.1246045369828; Fri, 
	26 Jun 2009 12:42:49 -0700 (PDT)
Date: Fri, 26 Jun 2009 12:42:49 -0700 (PDT)
In-Reply-To: <25fadd6f-094c-4e69-b214-7651da1afb4d@n21g2000vba.googlegroups.com>
X-IP: 82.182.254.46
References: <25fadd6f-094c-4e69-b214-7651da1afb4d@n21g2000vba.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.10) 
	Gecko/2009042700 SUSE/3.0.10-1.1.1 Firefox/3.0.10,gzip(gfe),gzip(gfe)
Message-ID: <0174ed50-5f58-481b-beed-6bafb2ab0dab@g20g2000vba.googlegroups.com>
Subject: Re: segment matching variables in Qi-YACC (for Snorgers ;))
From: snorgers <stefan.ta...@spray.se>
To: Qilang <Qilang@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Mark,

Cool this looks like a natural building block, but what do you think
about patterns like

(defcc <f>
 <<L>> <numbers> <<L>> :=3D ...)

They is nice to have for situations like
<string-prefix> <<boundary>> <endl> <<String>> <<boundary>> :=3D (COERCE
<<String>> STRING);


/Stefan

On 26 June, 11:37, Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:
> Here is a sugaring on top of Qi that enables you to have segment
> matching variables in Qi-YACC. =A0<<...>> is a stuff matcher.
>
> (defcc <grab-numbers>
> =A0 =A0 =A0 =A0<<X>> <numbers> <<Y>> :=3D <numbers>;)
>
> (defcc <numbers>
> =A0 =A0 =A0 =A0<number> <numbers>;
> =A0 =A0 =A0 =A0<number>;)
>
> (defcc <number>
> =A0 =A0 =A0 =A0 -*- :=3D (if (number? -*-) [-*-] #\Escape);)
>
> (defcc <grab-my-name>
> =A0 =A0<<X>> :name <<Y>> :=3D <<Y>>;)
>
> Examples:
>
> (compile <grab-my-name> [ghhghg 7 8 :name Mark Tarver])
> [Mark Tarver]
>
> (compile <grab-numbers> [just some numbers 1 2 3/4 tum te tum])
> [1 2 3/4]
>
> The code is 85 lines.
>

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google