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 ;))
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Mark Tarver  
View profile   Translate to Translated (View Original)
 More options 26 June, 20:46
From: "Mark Tarver" <dr.mtar...@ukonline.co.uk>
Date: Fri, 26 Jun 2009 20:46:10 +0100
Local: Fri 26 June 2009 20:46
Subject: Re: segment matching variables in Qi-YACC (for Snorgers ;))
As of now, the second <<L>> would bind over the first.  No identity would be
created.  you would have to have

(defcc <f>
 <<L1>> <numbers> <<L2>> := (if (= <<L1>> <<L2>>) ..... #\Escape);)

----- Original Message -----
From: "snorgers" <stefan.ta...@spray.se>
To: "Qilang" <Qilang@googlegroups.com>
Sent: Friday, June 26, 2009 8:42 PM
Subject: Re: segment matching variables in Qi-YACC (for Snorgers ;))

Hi Mark,

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

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

They is nice to have for situations like
<string-prefix> <<boundary>> <endl> <<String>> <<boundary>> := (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. <<...>> is a stuff matcher.

> (defcc <grab-numbers>
> <<X>> <numbers> <<Y>> := <numbers>;)

> (defcc <numbers>
> <number> <numbers>;
> <number>;)

> (defcc <number>
> -*- := (if (number? -*-) [-*-] #\Escape);)

> (defcc <grab-my-name>
> <<X>> :name <<Y>> := <<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.

> Mark


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

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