Annotate math expressions

Now with the scripting language Lua having access to the TeX internals, it is quite easy to generate PDF annotations automatically.
An interesting example I started to explore is whether it would be possible to generate Content MathML expressions from the low level
TeX mathlist node representations exposed via the proper LuaTeX callback mlist_to_hlist.

Succinctly, it is possible to generate Content MathML from simple math formulas, however my initial approach using context free grammar parsers, (i.e. lpeg) are severely limited by the fact that the interpretation of LaTeX math expressions is rather context sensitive.

A much simpler topic is how Lua(La)TeX could be used to automatically generate math expression bounding boxes in PDF documents, such
that extraction programs can reliably identify text areas in the PDF document that pertain to math formulas.