Zulip Chat Archive

Stream: metaprogramming / tactics

Topic: Using `syntax` with functions to declare literals


nrs (Nov 25 2024 at 23:21):

I've been reading the metaprogramming book, and as I understand it examples consist of explicitly writing out a literal and then using the metaprogramming API to combine them, e.g. with <|> or +, etc. But I was wondering, is there a way to use functions such as Char.isAlphanum, or define the literals given by even numbers with e.g. (. % 2 == 0)?

nrs (Nov 25 2024 at 23:25):

ah it seems these would literally be Parser declarations; see Parser/Term.lean's def num


Last updated: May 02 2025 at 03:31 UTC