- From: Frédéric WANG <fred.wang@free.fr>
- Date: Fri, 06 Mar 2009 19:42:50 +0100
- To: www-amaya@w3.org
>
> 2. introduce modes -- set of additional rules. For example in "chemistry
> mode" to all <mi> with content element=H,He,Li,...,Mt class="chem"
> will be
> added, so with switched chem mode it will take seconds to type
> K[Fe(CN)6]2-
> (here C and N should be automatically splited). In LaTeX for the same
> purpose I use predefined command \chem. Another example "units
> mode": class
> "MathML-Unit <http://www.w3.org/TR/mathml-units/>" will be added.
> In both
> cases styles of identifier will be written in css.
>
Hi Vladislav,
So finally I found time to study how to implement your proposal in
Amaya. Today, I've committed an experimental parser for chemical
formulae (currently disabled). I would like to know more precisely the
syntax and semantic of the language. For the moment, the parser can only
read a single chemical formula at a time. Is it what you expect or do
you think the language should be extended to recognize chemical
equations such that "8H3O+ + MnO4- + 5e- -> Mn2+ + 4H2O"? Also, In the
example you gave, you use both brackets and parenthesis. What is the
semantic difference between the two symbols? Currently, the parser uses
them to determine an order of priority and do not generate the
corresponding <mo>'s in the MathML code. FYI, here is the grammar used:
list_of_formulae: list_of_formulae chemical_formula | chemical_formula
chemical_formula: chemical_formula2 | chemical_formula2 integer
chemical_formula2: atom | '(' list_of_formulae ')' | '['
list_of_formulae ']' | chemical_formula2 exponent
exponent: integer sign | sign
atom:H|He|Li|Be|B|C|N|O|F|Ne|Na|Mg|Al|Si|P|S|Cl|Ar|K|Ca|Sc|Ti|V|Cr|Mn|Fe|Co|Ni|Cu|Zn|Ga|Ge|As|Se|Br|Kr|Rb|Sr|Y|Zr|Nb|Mo|Tc|Ru|Rh|Pd|Ag|Cd|In|Sn|Sb|Te|I|Xe|Cs|Ba|La|Ce|Pr|Nd|Pm|Sm|Eu|Gd|Tb|Dy|Ho|Er|Tm|Yb|Lu|Hf|Ta|W|Re|Os|Ir|Pt|Au|Hg|Tl|Pb|Bi|Po|At|Rn|Fr|Ra|Ac|Th|Pa|U|Np|Pu|Am|Cm|Bk|Cf|Es|Fm|Md|No|Lr|Rf|Db|Sg|Bh|Hs|Mt|Ds|Rg|Uub|Uut|Uuq|Uup|Uuh|Uus|Uuo
integer: [0-9]+
sign: -|+
Frédéric Wang
Received on Friday, 6 March 2009 18:46:54 UTC