lean4-htt/doc/metaprogramming.md
ammkrn 7539799976 doc: add macro guide, light reorganizing
Sebastian suggested moving the macro guide from Mathlib4 upstream into the Lean 4 manual (called `macro_overview.md` here). There was some discussion about where to put it; the section on metaprogramming seemed like the most appropriate place. I did a little bit of reorganizing to make some items more discoverable (e.g. the user-defined notation section).
2021-11-22 11:02:07 +01:00

490 B

Metaprogramming

Macros are a language feature that allows writing code that writes other code (metaprogramming).

In Lean 4, macros are used pervasively. So much so that core language features such as do notation is implemented via macros! As a language user, macros are useful to easily embed domain-specific languages and to generate code at compile-time, to name a few uses.

References