OpenersNotesSection(Spacer1)Details

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (6)

Interpret MathML inputs without evaluating them:

Interpreter["HeldMathMLExpression"]["<math><mrow><mn>2</mn><mo>+</mo><mn>2</mn></mrow></math>"]

Interpreter["HeldMathMLExpression"]["<math><mrow><mi>sin</mi><mo>&#8289;</mo><mo>(</mo><mi>0</mi><mo>)</mo></mrow></math>"]

No evaluation is attempted when matching the choices:

Interpreter[Restricted["HeldMathMLExpression",{{True, False}}]]["<math><mrow><mn>2</mn><mo>==</mo><mn>2</mn></mrow></math>"]

Interpreter[Restricted["HeldMathMLExpression",{{HoldComplete[Equal[2,2]],False}}]]["<math><mrow><mn>2</mn><mo>==</mo><mn>2</mn></mrow></math>"]

By default, all symbols are allowed. Restrict to a list of allowed symbols:

Interpreter[Restricted["HeldMathMLExpression",{Plus}]]["<math><mrow><mn>2</mn><mo>+</mo><mn>2</mn></mrow></math>"]

Interpreter[Restricted["HeldMathMLExpression",{Plus}]]["<math><mrow><mn>2</mn><mo>*</mo><mn>2</mn></mrow></math>"]

By default, new symbols are created in (RefLink[$Context, paclet:ref/$Context]), but a custom context can be specified:

Interpreter[Restricted["HeldMathMLExpression",Automatic,Automatic,Automatic]]["<math><mrow><mn>x</mn></mrow></math>"]
Context[x]

Interpreter[Restricted["HeldMathMLExpression",Automatic,Automatic,"mycontext`"]]["<math><mrow><mn>y</mn></mrow></math>"]
Context[x]

Specify contexts for the allowed and output symbols:

Global`z = 10;
Interpreter[Restricted["HeldMathMLExpression",Automatic,{"Global`","System`"},"Global`"]]["<math><mrow><mi>sin</mi><mo>&#8289;</mo><mo>(</mo><mi>z</mi><mo>)</mo></mrow></math>"]

Prevent the creation of any new symbol:

Interpreter[Restricted["HeldMathMLExpression",Automatic,Automatic,None]]["<math><mrow><mn>2</mn><mo>+</mo><mn>2</mn></mrow></math>"]

Interpreter[Restricted["HeldMathMLExpression",Automatic,Automatic,None]]["<math><mrow><mn>z</mn><mo>+</mo><mn>2</mn></mrow></math>"]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Interpreter, paclet:ref/Interpreter])  ▪  (RefLink[Restricted, paclet:ref/Restricted])  ▪  (RefLink[Failure, paclet:ref/Failure])  ▪  (RefLink[HoldComplete, paclet:ref/HoldComplete])}, {Related Interpreter Types:  (RefLink[MathMLExpression, paclet:ref/interpreter/MathMLExpression])  ▪  (RefLink[InactiveMathMLExpression, paclet:ref/interpreter/InactiveMathMLExpression])  ▪  (RefLink[TeXExpression, paclet:ref/interpreter/TeXExpression])  ▪  (RefLink[HeldTeXExpression, paclet:ref/interpreter/HeldTeXExpression])  ▪  (RefLink[InactiveTeXExpression, paclet:ref/interpreter/InactiveTeXExpression])}, {Related Formats:  (RefLink[LaTeX, paclet:ref/format/LaTeX])  ▪  (RefLink[XHTML, paclet:ref/format/XHTML])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Setting Up Input Interpreters, paclet:guide/InterpretingStrings])}})}})