[Top][All Lists]

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

Re: how to implement mutual recursive parsers in syntax-parse

From: Andy Wingo
Subject: Re: how to implement mutual recursive parsers in syntax-parse
Date: Mon, 21 May 2012 10:25:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

On Fri 18 May 2012 23:58, Stefan Israelsson Tampe <address@hidden> writes:

> is master supposed to expand and evaluate all the syntax defines
> before expanding the defines?

Yes, provided they are within one expansion unit -- i.e. a "begin"
statement.  Separate toplevel forms are expanded separately.

> And if a plain macro is encountered at the toplevel it is expanded as
> well in the first run. I don't understand exactly how the expansion
> progresses so can you describe or link to a description?

>From psyntax.scm:

    ;; At top-level, we allow mixed definitions and expressions.  Like
    ;; expand-body we expand in two passes.
    ;; First, from left to right, we expand just enough to know what
    ;; expressions are definitions, syntax definitions, and splicing
    ;; statements (`begin').  If we anything needs evaluating at
    ;; expansion-time, it is expanded directly.
    ;; Otherwise we collect expressions to expand, in thunks, and then
    ;; expand them all at the end.  This allows all syntax expanders
    ;; visible in a toplevel sequence to be visible during the
    ;; expansions of all normal definitions and expressions in the
    ;; sequence.



reply via email to

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