> On 28 May 2023, at 20:12, Maury Markowitz <maury.markow...@gmail.com> wrote: > > Following, sort of, some advice I received earlier I modified my bison by > adding this: > > open_bracket: > '(' | '['; > close_bracket: > ')' | ']’;
You probably do not want to exchange delimiter types, as in "(…]" and "[…)". > And then modified the original code thus: > > variable: > VARIABLE_NAME > { > variable_t *new = malloc(sizeof(*new)); > new->name = $1; > new->subscripts = NULL; > new->slicing = NULL; > $$ = new; > } > | > VARIABLE_NAME open_bracket exprlist close_bracket > { > variable_t *new = malloc(sizeof(*new)); > new->name = $1; > new->subscripts = $3; > new->slicing = NULL; > $$ = new; > } To exclude that, use: operator_value: VARIABLE_NAME '(' exprlist ')' | VARIABLE_NAME '[' exprlist ']' ; Or more structured (in a C++-like syntax): operator_value: function_value | index_value ; function_value: VARIABLE_NAME '(' exprlist ')' ; index_value: VARIABLE_NAME '[' exprlist ']' ;