nfl/lower

Search:
Group by:

Lowering: rewrites already macro-expanded Syntax forms in place, resolving NFL-specific surface syntax (let/set!, loop/recur, defclass, object-variant match patterns, and similar) down to a shape backend.nim can emit directly as Nim AST. Runs after expand.nim and before backend.nim.

Procs

proc lowerExpr(sx: Syntax): Syntax {....raises: [CompilerError, Exception, KeyError],
                                     tags: [RootEffect], forbids: [].}
Lowers a single expanded expression in a fresh, empty scope. Mutates sx in place and returns it, for embedding a lone NFL expression directly in Nim code (nflExpr).
proc lowerModule(forms: seq[Syntax]): seq[Syntax] {.
    ...raises: [CompilerError, Exception, KeyError], tags: [RootEffect],
    forbids: [].}
Lowers a whole module's expanded top-level forms in a shared scope, so later forms see bindings introduced by earlier ones. Mutates forms in place and returns it.