I'm interested in your long-term task. I think that would be useful to do. I'm willing to work on that with you, especially if there is no hurry.
I don't think there is any operator precedence in StarMath 5.0, which is why it is important to use explicit { ... }. It would be interesting to know what the rule for implicit multiplication might be also, concerning the "2b" in a+{2b}. That should be easy to check, and also to determine how clean unary versus binary operations are distinguished. I'm not clear that a grammar is easy to derive in the sense of BNF. One way would be to try enough of the operators, brackets, etc., and see how they map. One could also look at the parser in the code. Before going too far down that road, perhaps the OpenOffice Forums have something in their collection of material. I expect that the parser is relatively simple with many reserved works, providing more of a markup notation than a formula notation. (I suspect the result is presentation of a formula more than it is something that can be interpreted as a formula in the sense of evaluation or symbolic manipulation.) I just looked at the commands.src file in AOO/trunk/main/staremath/source/ and I think that tells you a lot about the grammar. I couldn't find anything about the attributes. Experiments may be needed there. My thinking is that there are some useful tests to run. In particular, will OpenOffice Math work properly on an ODF Formula document that has no annotation? (I.e., the StarMath portion is missing.) If the StarMath is required, there is a pretty significant defect in either ODF 1.2 Part 1 or in the implementation, since there is not enough information for someone to interoperate one way, the other, or both. If OpenOffice Math will open a MathML that has no (recognizable) annotation, you could check the example you have, and others, by seeing what StarMath AOO shows when such a MathML is loaded. That would provide information for deducing the grammar. In particular, it would help understand where {...} are needed for some of the attributes, how brackets and {...} interact, etc. Is this interesting? - Dennis -----Original Message----- From: Regina Henschel [mailto:rb.hensc...@t-online.de] Sent: Wednesday, November 12, 2014 00:18 To: dev@openoffice.apache.org Subject: Re: grammar for StarMath Hi Dennis, thank you for looking at it. But I'm looking for a BNF or other form of derivation rules or any kind of informal specification. The exported MathML is known to have structural deficits, for example 'a + 2 b' will result in <mrow> <mi>a</mi> <mo stretchy="false">+</mo> <mn>2</mn> </mrow> <mi>b</mi> which is a structure '{a+2} b', where it should be a structure 'a + {2 b}'. It is a long-term task (in which I'm interested) to get a better representation of the formulas in MathML and so be able to drop StarMath. And therefore I'm looking for some developer information about StarMath. If such does not exist, the way through examining code and examples will be harder. Kind regards Regina Dennis E. Hamilton schrieb: > I have an incomplete result. You may have already explored this. > > First, saving an AOO Formula (.odf) as a StarMath 5.0 Formula (.smf) does not > seem to be exported. There is no import for it either. > > You can still save as an OpenDocument.org .sxm formula or an ODF Formula > (.odf). They are nearly identical. > > Both .sxm and .odf are Zip Packages and nearly identical. In particular, the > content.xml is a MathML formula that has a StarMath 5.0 formula as an > annotation. It is exactly the same formula that you end up editing in the > lower window of the Apache OpenOffice Math (or LibreOffice Math) application. > So the upper window shows the MathML rendering, and the lower window shows > the StarMath 5.0! And the content.xml carries both. > > In effect, the Elements Tool and the hand editing that you do is creating > StarMath that is then displayed via MathML in the upper, graphical-formula > window. > > That doesn't provide the StarMath grammar except by example, but it is a way > to build them experimentally and see. > > Finally, this led me to the Help Topic "Math formula editor" and click the > Formulas link to get to "Welcome to the OpenOffice Math Help" page. The > subtopic "Formula Reference Tables" seems to be the key. The color function > is under "Attributes". > > StarMath uses {...} for precedence/grouping control in the same manner as TeX > and LaTeX formulas. > > We can probably figure out the grammar by making examples of all the > operators and other oddities. > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org