Zulip Chat Archive

Stream: lean4

Topic: Odd precedence in syntax command


Mario Carneiro (Aug 18 2021 at 01:12):

I find these precedence relations involving <|> unintuitive:

syntax "foo" term <|> "bar" term : term
syntax "foo" ("*" <|> term,+) : term

means

syntax "foo" (term <|> "bar") term : term
syntax "foo" (("*" <|> term),+) : term

For the first example (of <|> over adjacency), I would also look to regex for inspiration, where foo|bar means (foo)|(bar) rather than fo(o|b)ar, and similarly a|b*means a|(b*) instead of (a|b)*.

Sebastian Ullrich (Aug 18 2021 at 11:52):

The second case should be fixed since https://github.com/leanprover/lean4/commit/6c220423ed8c7d605debe54973d88df98ed49cef#diff-540183f8aeafc938225f04a4930bd51fbbbe9cb4ebdf3ce35136a7d816f250bcR55


Last updated: Dec 20 2023 at 11:08 UTC