Skip to content

feat: run_macro & run_cmd_macro #7524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tydeu
Copy link
Member

@tydeu tydeu commented Mar 17, 2025

This PR adds MacroM support to #eval with the associated run_macro convenience command. It also adds run_cmd_macro, which evaluates a MacroM Command and then immediately elaborates the produced command.

The run_cmd_macro utility circumvents the need to define local command syntax just to expand a single-use macro. For example:

-- # Previously
local macro "gen_stuff%" : command =>
  genStuff -- meta code to generate some commands
gen_stuff% -- perform the generation

-- # With this change
run_cmd_macro genStuff -- perform generation, no new syntax necessary

@tydeu tydeu added the changelog-language Language features, tactics, and metaprograms label Mar 17, 2025
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Mar 17, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 17, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 17, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 17, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 17, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Mar 17, 2025

Mathlib CI status (docs):

@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Mar 17, 2025
@tydeu tydeu marked this pull request as ready for review March 17, 2025 16:28
@tydeu tydeu requested a review from Kha March 17, 2025 16:28
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Mar 17, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features, tactics, and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants