This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / New in Version 3.0 / Programming  /

  • ToExpression[ input ] gives the expression obtained by interpreting strings or boxes as Mathematica input.
  • ToExpression[ input , form ] uses interpretation rules corresponding to the specified form.
  • ToExpression[ input , form , h ] wraps the head h around the expression produced before evaluating it.
  • Example: ToExpression["1 + 1"].
  • form can be InputForm, StandardForm or TraditionalForm.
  • ToExpression[" string "] uses InputForm interpretation rules.
  • ToExpression[ boxes ] uses StandardForm interpretation rules.
  • ToExpression prints a message and returns $Failed if it finds a syntax error. ToExpression does not call $SyntaxHandler.
  • The input given in ToExpression can correspond to multiple Mathematica expressions. ToExpression processes each one in turn, just like Get.
  • ToExpression[ input , form , Hold] can be used to convert input to an expression, but with the expression wrapped in Hold to prevent evaluation.
  • ToExpression uses any relevant definitions given for MakeExpression.
  • See the Mathematica book: Section 2.8.4.
  • See also: Symbol, MakeExpression, ToString, ToBoxes, SyntaxQ, SyntaxLength, Read, Get.