The Interpretation of Textual Forms

ToExpression[input]create an expression by interpreting strings or boxes

Converting from strings or boxes to expressions.

This takes a string and interprets it as an expression:
Click for copyable input
Here is the box structure corresponding to the textual form of an expression in StandardForm:
Click for copyable input
ToExpression interprets this box structure and yields the original expression again:
Click for copyable input

In any Wolfram System session, the Wolfram System is always effectively using ToExpression to interpret the textual form of your input as an actual expression to evaluate.

If you use the notebook front end for the Wolfram System, then the interpretation only takes place when the contents of a cell are sent to the kernel, say for evaluation. This means that within a notebook there is no need for the textual forms you set up to correspond to meaningful Wolfram System expressions; this is only necessary if you want to send these forms to the kernel.

FullFormexplicit functional notation
InputFormonedimensional notation
StandardFormtwodimensional notation

The hierarchy of forms for standard Wolfram System input.

Here is an expression entered in FullForm:
Click for copyable input
Here is the same expression entered in InputForm:
Click for copyable input
And here is the expression entered in StandardForm:
Click for copyable input

Built into the Wolfram System is a collection of standard rules for use by ToExpression in converting textual forms to expressions.

These rules define the grammar of the Wolfram System. They state, for example, that x+y should be interpreted as Plus[x,y], and that Null should be interpreted as Power[x,y]. If the input you give is in FullForm, then the rules for interpretation are very straightforward: every expression consists just of a head followed by a sequence of elements enclosed in brackets. The rules for InputForm are slightly more sophisticated: they allow operators such as +, =, and ->, and understand the meaning of expressions where these operators appear between operands. StandardForm involves still more sophisticated rules, which allow operators and operands to be arranged not just in a onedimensional sequence, but in a full twodimensional structure.

The Wolfram System is set up so that FullForm, InputForm, and StandardForm form a strict hierarchy: anything you can enter in FullForm will also work in InputForm, and anything you can enter in InputForm will also work in StandardForm.

If you use a notebook front end for the Wolfram System, then you will typically want to use all the features of StandardForm. If you use a textbased interface, however, then you will typically be able to use only features of InputForm.

When you use StandardForm in a Wolfram System notebook, you can enter directly twodimensional forms such as x2 or annotated graphics. But InputForm allows only onedimensional forms.

If you copy a StandardForm expression whose interpretation can be determined without evaluation, then the expression will be pasted into external applications as InputForm. Otherwise, the text is copied in a linear form that precisely represents the two-dimensional structure using !(). When you paste this linear form back into a Wolfram System notebook, it will automatically "snap" into twodimensional form.

ToExpression[input,form]attempt to create an expression assuming that input is given in the specified textual form

Importing from other textual forms.

StandardForm and its subsets FullForm and InputForm provide precise ways to represent any Wolfram System expression in textual form. And given such a textual form, it is always possible to convert it unambiguously to the expression it represents.

TraditionalForm is an example of a textual form intended primarily for output. It is possible to take any Wolfram System expression and display it in TraditionalForm. But TraditionalForm does not have the precision of StandardForm, and as a result there is in general no unambiguous way to go back from a TraditionalForm representation and get the expression it represents.

Nevertheless, ToExpression[input,TraditionalForm] takes text in TraditionalForm and attempts to interpret it as an expression.

This takes a string and interprets it as TraditionalForm input:
Click for copyable input
In StandardForm the same string would mean a product of terms:
Click for copyable input

When TraditionalForm output is generated as the result of a computation, the actual collection of boxes that represent the output typically contains special Interpretation objects or other specially tagged forms that specify how an expression can be reconstructed from the TraditionalForm output.

The same is true of TraditionalForm that is obtained by explicit conversion from StandardForm. But if you edit TraditionalForm extensively, or enter it from scratch, then the Wolfram System will have to try to interpret it without the benefit of any additional embedded information.