From: Andy Wingo <wingo@pobox.com>
To: Noah Lavine <noah.b.lavine@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: PEG Patches
Date: Tue, 29 Mar 2011 10:00:08 +0200 [thread overview]
Message-ID: <m3vcz29x13.fsf@unquote.localdomain> (raw)
In-Reply-To: <AANLkTi=POAxkq37oC9UPFb-Atz=J=zuRSBeZCzPowdNF@mail.gmail.com> (Noah Lavine's message of "Mon, 28 Mar 2011 16:44:37 -0400")
On Mon 28 Mar 2011 22:44, Noah Lavine <noah.b.lavine@gmail.com> writes:
> - say that string PEGs can only occur at the top level of a PEG
> expression. The peg module has never been released, so no one uses
> this feature now anyway.
> - instead of defining a new function peg-extended-compile, redefine
> peg-sexp-compile via set! once we have string pegs.
> - write peg-extended-compile as its own big case statement, basically
> duplicating peg-sexp-compile.
> - adopt some interface that allows people to extend the cases in
> peg-sexp-compile. We would start with just s-expression PEGs, then use
> this interface to add string PEGs later in the load sequence.
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?
Andy
--
http://wingolog.org/
next prev parent reply other threads:[~2011-03-29 8:00 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 [this message]
2011-03-29 12:47 ` Noah Lavine
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=m3vcz29x13.fsf@unquote.localdomain \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=noah.b.lavine@gmail.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).