unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Noah Lavine <noah.b.lavine@gmail.com>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: PEG Patches
Date: Tue, 29 Mar 2011 08:47:53 -0400	[thread overview]
Message-ID: <AANLkTimerM7U2SVR-hwiQg1wvf-4MNbk+BSJY_0z_arF@mail.gmail.com> (raw)
In-Reply-To: <m3vcz29x13.fsf@unquote.localdomain>

> This last is the best.  What if we define a module that serves as a
> registry of PEG match behaviors, like `(ice-9 peg matchers)'.  Then we
> define `define-peg-matcher' or something, so that we can:
>
> (define-peg-matcher and cg-and)
>
> where define-peg-matcher is
>
> (define-syntax define-peg-matcher
>  (syntax-rules ()
>    ((_ name binding)
>     (module-define! (resolve-module '(ice-9 peg matchers))
>                      'name
>                      binding))))
>
> Then instead of defining separate cases for ignore, range, etc the
> peg-sexp-compile macro does:
>
>  ((matcher arg ...) (identifier? #'matcher)
>   ((module-ref (resolve-module '(ice-9 peg matchers))
>                (syntax->datum #'matcher))
>    #'(arg ...)
>    mode))
>
> Then the peg-string module registers a matcher for `peg'.
>
> Dunno.  WDYT?

That's doable. But if we're going to choose what to do entirely based
on the first element of the list, then we could also just not define
peg-sexp-compile at all and make each of the code generation functions
into macros.

How does that sound?



  reply	other threads:[~2011-03-29 12:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-06  5:25 PEG Patches Noah Lavine
2011-03-07  1:28 ` Noah Lavine
2011-03-25 18:06 ` Andy Wingo
2011-03-28 20:44   ` Noah Lavine
2011-03-28 20:46     ` Noah Lavine
2011-03-28 22:17     ` Michael Lucy
2011-03-29  8:00     ` Andy Wingo
2011-03-29 12:47       ` Noah Lavine [this message]
2011-03-29 13:20         ` Andy Wingo
2011-03-31 21:48           ` Noah Lavine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimerM7U2SVR-hwiQg1wvf-4MNbk+BSJY_0z_arF@mail.gmail.com \
    --to=noah.b.lavine@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).