$PreRead

$PreRead

is a global variable whose value, if set, is applied to the text or box form of every input expression before it is fed to the Wolfram Language.

Details

  • $PreRead is always applied to each complete input string that will be fed to the Wolfram Language.
  • In multiline input with a textbased interface, whenever each line is terminated, $PreRead is typically applied to the input so far.
  • $PreRead is applied to all strings returned by a $SyntaxHandler function.
  • $PreRead is applied before InString[n] is assigned.

Examples

Basic Examples  (3)

By default, $PreRead is not defined, meaning input strings are sent directly to evaluation:

Use "hf" as an alias for HoldForm:

Restore $PreRead to its default value:

Have the Wolfram Language print the FullForm of parsed input expressions before evaluation:

Restore $PreRead to its default value:

Introduced in 1991
 (2.0)