[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PEG Patches
From: |
Noah Lavine |
Subject: |
Re: PEG Patches |
Date: |
Tue, 29 Mar 2011 08:47:53 -0400 |
> 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?
- PEG Patches, Noah Lavine, 2011/03/06
- Re: PEG Patches, Noah Lavine, 2011/03/06
- Re: PEG Patches, Andy Wingo, 2011/03/25
- Re: PEG Patches, Noah Lavine, 2011/03/28
- Re: PEG Patches, Noah Lavine, 2011/03/28
- Re: PEG Patches, Michael Lucy, 2011/03/28
- Re: PEG Patches, Andy Wingo, 2011/03/29
- Re: PEG Patches,
Noah Lavine <=
- Re: PEG Patches, Andy Wingo, 2011/03/29
- Re: PEG Patches, Noah Lavine, 2011/03/31