I’ve been interested in this for quite some time. They already have a whole bunch, and they can be overloaded, so why not do it to the end and allow user statements? I think this can be a great addition.
I was told that this would make the language too complicated to compile. It makes me wonder if C ++ cannot really be designed for easy compilation anyway, is it really impossible? Of course, if you use an LR parser with a static table and grammar like
E → T + E | T T → F * T | F F → id | '(' E ')'
it will not work. In Prolog, which is usually analyzed using the AFAIK operator analyzer, you can easily define new operators, but the language is much simpler. Now the grammar can obviously be rewritten to accept identifiers in all places where the operator is hard-coded into the grammar.
What other solutions and parser schemes exist and what other things influenced this design decision?
source share