Zulip Chat Archive

Stream: metaprogramming / tactics

Topic: Parser matching `'` or `,`


Leni Aniva (Jan 17 2026 at 01:38):

Is it possible to write a syntax and elaborator which matches a sequence of ' or ,? For example,

f'' z,,

Using the * combinator doesn't work.

Aaron Liu (Jan 17 2026 at 01:57):

yes it's probably possible

Aaron Liu (Jan 17 2026 at 01:57):

can you give more details

Leni Aniva (Jan 17 2026 at 01:57):

Aaron Liu said:

yes it's probably possible

I want to match identifier ,* '* e.g. a123'''

Aaron Liu (Jan 17 2026 at 01:59):

note that a123''' is a valid identifier

Aaron Liu (Jan 17 2026 at 02:01):

Leni Aniva said:

Using the * combinator doesn't work.

what did you try

Leni Aniva (Jan 17 2026 at 02:04):

Aaron Liu said:

Leni Aniva said:

Using the * combinator doesn't work.

what did you try

declare_syntax_cat mystery
syntax (name := mystery1) ident ","* : mystery

This part is easy, but then when I write the macro matching the syntax using (mystery|$x:ident $occ:","*) doesn't work.

Aaron Liu (Jan 17 2026 at 02:15):

this works (mystery| $x:ident $[,%$occ]*)


Last updated: Feb 28 2026 at 14:05 UTC