Author: Deyan Ginev
This note suggests a two-step alogrithm for transforming intent expressions into Content MathML. First, we offer rules to build an operator tree with symbols in the “intent” virtual content dictionary. Second, we suggest a “phrase book” for mapping those operator trees into Full Content MathML.
intent
This is the December 2022 state of MathML 4’s 5.1.1 The Grammar for intent.
The value of the intent
attribute, after ignoring white
space between tokens, should match the following grammar.
intent := concept-or-literal | number | reference | application concept-or-literal := NCName number := '-'? digit+ ( '.' digit+ )? reference := '$' NCName application := intent hint? '(' arguments? ')' arguments := intent ( ',' intent )* hint := '@' ( 'prefix' | 'infix' | 'postfix' | 'function' | 'silent' )
Here NCName
is as defined in [[xml-names]], and digit
is a character in the range 0–9.
Starting with an intent expression, we offer a to_content
procedure to create an operator tree, via the following list of transformation rules:
The rules are ordered, and should be matched top-first to bottom-last.
intent input | to_content output | Extra Requirement |
---|---|---|
hint | ignore | |
literal | ignore | |
concept |
| |
number |
| |
reference |
| |
|
ignore | "intent" head is a literal, arguments are all literals |
|
| "intent" head is concept, reference, number, compound expression, or literal different from "_". |
|
| "intent" head is the underscore literal, arguments contain exactly one concept argument. |
|
| "intent" head is the underscore literal, all other cases |
intent input | to_content output | Extra Requirement |
---|---|---|
|
||
| ||
|
|
|
|
|
|
|
|
|
|
| "intent" head is concept, reference, number, compound expression, or literal different from "_". |
|
| "intent" head is concept, reference, number, compound expression, or literal different from "_". |
|
| "intent" head is concept, reference, number, compound expression, or literal different from "_". |
|
| "intent" head is concept, reference, number, compound expression, or literal different from "_". |
| "intent" head is a literal, arguments are all literals |
|
|
| "intent" head is the underscore literal, arguments contain exactly one concept argument. |
|
| "intent" head is the underscore literal, all other cases |
The following (partial) map can be used to rewrite the virtual content dictionary trees as Full Content MathML.
It covers the chapter 4.4 Content MathML for Specific Operators and Constants.
Note that there are quite often known aliases for mathematical concepts (in narration, “addition” may be referred to as simply speaking the operator “plus” sign), and they would need to be included inside such phrase books in order to gain coverage (or, alternatively, an external “alias-resolution” mechanism would be needed, maybe provided by an Intent Open list).
intent CD input symbol | Full Content MathML output |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that this table only covers a selection of the simplest leaf-to-leaf mapping and remains silent on all tree-to-tree structural issues, such as: