For example Math currently parses expressions like this: "a + 2 b" => "{a + 2} b" instead of "a + {2 b}" "x + 3 y^2" => "{x + 3} y^2" instead of "x + 3 y^2" I tried to fix that in bug 66081, but I suspect it would be a bit more complicated than what I initially thought, so I'm moving it as a separate bug. Currently, the grammar used by starmath/source/parse.cxx is (approximately) as follows: Expression = Relation ([relation token] Relation)+ Relation = Sum ([sum token] Sum) + Sum = Product ([product token] Product)+ Product = Power ([power token] Power)+ Power = Term ([sub/sup script tokens] Term)+ Term = ['{' token] Expression ['}' token] | [text token] | [symbol token] | Matrix | Binom | ... other terms ... Binom = ['binom' token] Sum Sum Matrix = ... ... = other rules The parsing can be done linearly and stops when an unexpected token is read. What we'd like in order to fix this bug is to define Product = Power (([power token] Power)+ | Power+) so that an explicit [power token] like "*" is not needed to write a product i.e. we can write "a b" instead of "a * b". Unfortunately, after some attempts this breaks some unit tests. For example the naive parsing of "binom a b" could become Term => binom Sum Sum => binom Product Sum => binom (Power)+ Sum => binom (Term)+ Sum => binom a b Sum => binom a b Product => binom a b (Power)+ => binom a b (Term)+ => failure! rather than the expected Term => binom Sum Sum => binom Term Term => binom a b The grammar can probably be modified to avoid some of the issues but I suspect a general solution will require to use techniques like those of parsers generated by GNU bison (https://en.wikipedia.org/wiki/GNU_bison).
I think I don't have to say this again :-), but you already prove you are an expert in this domain. Feel free to mark your own bugs as NEW without any QA interaction. Except you would like to have a review/second opinion test etc. :) Kind regards, Joren
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.