Hi Maury, On Wed, Apr 12, 2023 at 06:38:35PM -0400, Maury Markowitz wrote:
> I am parsing a grammar that allows bracketing using (), [] and <>. It would > simplify my code if I could do… > open_bracket: ‘(‘ | ‘[‘ | ‘<‘ ; > close_bracket: ‘)‘ | ‘]‘ | ‘>’ ; > bracketed_expression : open_bracket expression close_bracket ; Indeed, that would parse the brackets independently. Since "expression" is a nonterminal, you can just use bracketed_expression: '(' expression ')' | '[' expression ']' | '{' expression '}' to get the behaviour you want, and then you'd use { $$ = $2; } to pass through the value. Simon