Zulip Chat Archive

Stream: general

Topic: notation/macro_rules trouble


Quinn (Sep 11 2024 at 17:06):

def f (x y z : Int) : Int := x + y + z

syntax "{{" term:90 "}}" term:91 "{{" term:92 "}}" : term
macro_rules
  | `({{$x}} $y {{$z}}) => `(f $x $y $z)

any indication why the closing paren at {{ $z }}) is getting unexpected token ')'; expected term?

Sebastian Ullrich (Sep 11 2024 at 17:15):

$y {{$z}} is a valid parse for term:91 as the precedence of application is much higher than that, try term:max instead

Avi Craimer (Sep 17 2024 at 00:08):

Sebastian Ullrich said:

$y {{$z}} is a valid parse for term:91 as the precedence of application is much higher than that, try term:max instead

Is there some way to check or lookup the actual numerical value for precedence of built in Lean syntax constructs? e.g., function application, typing (:), def, match _ with, etc. ?


Last updated: May 02 2025 at 03:31 UTC