guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PEG Parser Updates/Questions


From: Phil
Subject: Re: PEG Parser Updates/Questions
Date: Sun, 29 Aug 2010 02:45:19 -0500

So is there a sort of ETA on when this will be part of Guile?

On Fri, Aug 20, 2010 at 4:30 PM, Andy Wingo <address@hidden> wrote:
> Hello, Mr. Lucy!
>
> At some point I might escape the need to apologize at every mail I send,
> but until then: sorry for the late response!
>
> On Thu 05 Aug 2010 23:40, Michael Lucy <address@hidden> writes:
>
>> On Wed, Jul 28, 2010 at 12:13 AM, Michael Lucy <address@hidden> wrote:
>>> I've officially eliminated the last define-macro expression.
>>>
>>> However, I get the feeling that things may not be exactly as desired.
>>> The original program made extensive use of functions in building the
>>> macros, and I originally tried to replace these with macros.  This
>>> turned out to be a little difficult to debug, however (read: I was
>>> unable to make the code actually work).  I eventually abandoned this
>>> and just made datum->syntax calls.
>
> I'll have to check and see what the deal is. However note that with
> procedural macros you can still use helper functions that operate on
> syntax objects, destructing them via syntax and building up syntax
> objects using `syntax'. Think of a procedural macro as consisting of one
> helper function :)
>
>>> The downside is that one doesn't get all the same benefits of
>>> referential transparency, so I still have gensyms in the functions
>>> etc.  Is this a problem?
>
> Yep! But it probably won't be a big deal to fix.
>
>>> Another question about module namespaces:  I have some syntax that I'd
>>> like to be available to code generated by macros in my module, but
>>> which I'd rather not export to the user (to avoid clobbering their
>>> functions).  Is there a standard way of doing this?
>
> Phil mentioned @ and @@, but the normal case is that things Just Work,
> due to the referential-transparency-preserving properties of
> syntax-case.
>
> For example:
>
>    (define-module (a)
>      #:export (b))
>
>    (define-syntax b
>      (lambda (x)
>        (syntax-case x ()
>          ((_ exp)
>           #'(c exp)))))
>
>    (define-syntax c
>      (syntax-rules ()
>        ((_ exp) (car exp))))
>
>    (define-module (d)
>      #:use-module (a))
>
>    (b '(1 2 3))
>     => 1
>
> You see that the expansion of `(b '(1 2 3))' in the module `(d)'
> produced a reference to `c' -- but `c' is private in the `(a)'
> module. Barring the use of datum->syntax, syntax-case macros *scope free
> identifiers within the lexical conext and module in which they
> appear*. That's what "hygiene" is.
>
> Anyway, I hope to have time to poke this next week. I'm very much
> looking forward to having a good PEG parser!
>
> Cheers,
>
> Andy
> --
> http://wingolog.org/
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]