> On 17 Jun 2018, at 16:02, Akim Demaille <a...@lrde.epita.fr> wrote:
> Or go for a lighter syntax... Indeed. > expr: > NUM > | expr <int>{ $$ = 42; } '+' NUM { std::cout << $2 << '\n'; }; > Personally, I prefer the prefix forms, but they don’t blend > nicely with named references: > > expr: > NUM > | expr <int>{ $$ = 42; }[val] '+' NUM { std::cout << $val << '\n'; }; This is fact consistent with the order in the other declarations: <type> <variable> <name>. > I wish we had chosen a prefix syntax for named references, say > > expr: > NUM > | expr val={ $<int>$ = 42; } '+' NUM { std::cout << $<int>val << '\n'; }; If the type is in the variable, it implies a runtime variant cast, which one might want for some reason. (Just some bystander inputs.)