There is a grammar for the tex primitives in the texbook but not for the syntax that is allowed in tex documents including macro expansion as that can not be expressed in bnf
– David CarlisleSep 16 '16 at 13:14
2
all the discussion in the linked question to show there is no bnf for tex apply equally to math expressions, so I think that this is a duplicate.
– David CarlisleSep 16 '16 at 13:26
@DavidCarlisle I'm sorry about not explaining it clearly. What about if we do not consider macro expansion in the tex math expressions. It's a subset in a total tex document.
– 陈家泽Sep 16 '16 at 14:14
4
You would have to be a lot more specific as there are almost no math commands defined by default, for example \sqrt is a macro, \alpha isn't a primitive but is defined via a \mathchardef something like amsmath align is hundreds of macros implementing a custom syntax. there is nothing math-specific about tex parsing. So any answer here would apply equally to the linked question.
– David CarlisleSep 16 '16 at 14:16
\sqrtis a macro,\alphaisn't a primitive but is defined via a\mathchardefsomething like amsmathalignis hundreds of macros implementing a custom syntax. there is nothing math-specific about tex parsing. So any answer here would apply equally to the linked question. – David Carlisle Sep 16 '16 at 14:16