On this page:
expand-syntax-top-level-with-compile-time-evals
expand-top-level-with-compile-time-evals
expand-syntax-top-level-with-compile-time-evals/ flatten
eval-compile-time-part-of-top-level
eval-compile-time-part-of-top-level/ compile

5 Non-Module Compilation And Expansion

 (require syntax/toplevel)

Expands stx as a top-level expression, and evaluates its compile-time portion for the benefit of later expansions.

The expander recognizes top-level begin expressions, and interleaves the evaluation and expansion of of the begin body, so that compile-time expressions within the begin body affect later expansions within the body. (In other words, it ensures that expanding a begin is the same as expanding separate top-level expressions.)

The stx should have a context already, possibly introduced with namespace-syntax-introduce.

Like expand-syntax-top-level-with-compile-time-evals, but stx is first given context by applying namespace-syntax-introduce to it.

Like expand-syntax-top-level-with-compile-time-evals, except that it returns a list of syntax objects, none of which have a begin. These syntax objects are the flattened out contents of any begins in the expansion of stx.

Evaluates expansion-time code in the fully expanded top-level expression represented by stx (or a part of it, in the case of begin expressions). The expansion-time code might affect the compilation of later top-level expressions. For example, if stx is a require expression, then namespace-require/expansion-time is used on each require specification in the form. Normally, this function is used only by expand-top-level-with-compile-time-evals.

Like eval-compile-time-part-of-top-level, but the result is compiled code.