Zulip Chat Archive

Stream: lean4

Topic: parser category for structure fields?


Paro (Mar 20 2022 at 11:53):

I'm trying to write a macro for something like { e with $field := x }, but Lean parser keeps reporting "expected '}'" after $field.

Arthur Paulino (Mar 20 2022 at 12:36):

I think your syntax is conflicting with another syntax that already exists

Mario Carneiro (Mar 20 2022 at 12:41):

you need to specify that $field is an ident

Mario Carneiro (Mar 20 2022 at 12:41):

`({ e with $field:ident := x })

Arthur Paulino (Mar 20 2022 at 12:47):

@Mario Carneiro is it because of a conflict and specifying $ident removes it?

Mario Carneiro (Mar 20 2022 at 12:48):

it is because you can put more than just idents in that position

Mario Carneiro (Mar 20 2022 at 12:49):

i.e. { e with a[1] := 2 }


Last updated: Dec 20 2023 at 11:08 UTC