Zulip Chat Archive
Stream: lean4
Topic: nonReservedSymbol syntax
Kenny Lau (Aug 15 2025 at 11:32):
Is there a syntax for nonReservedSymbol?
open Lean
#check `(ident|X)
syntax foo := "X"
syntax "#asdf " foo : command
#check `(ident|X)
Basically I want to be able to still use X as an identifier after declaring it as part of the foo syntax
Damiano Testa (Aug 15 2025 at 12:17):
Is adding a & before the symbol what you are looking for?
Kenny Lau (Aug 15 2025 at 12:17):
aha!
Kenny Lau (Aug 15 2025 at 12:18):
@Damiano Testa do you know where this is documented?
Damiano Testa (Aug 15 2025 at 12:18):
I'm not sure and I'm not at a computer. Does hovering say something?
Kenny Lau (Aug 15 2025 at 12:19):
no it just links me back to nonReservedSymbol
Kyle Miller (Aug 15 2025 at 16:51):
It's mentioned here at least: https://lean-lang.org/doc/reference/latest/Notations-and-Macros/Defining-New-Syntax/#Lean___Parser___Syntax___nonReserved (a brief description is in the paragraph right before the anchor target)
Last updated: Dec 20 2025 at 21:32 UTC