Steps
Tests
What to Do
  • Reduce the work in postfixing by converting to canonical operations. So "Math.sin(", "math.sin(", "\sin(", and "sin(" all become "sin(".
  • Parse lots of LaTeX.
What Not to Do
  • Don't do anything that can more easily be done while postfixing.
  • Don't do anything that makes the output hard for humans to understand.
Steps
  1. Simple 1-to-1 substring replacements with important whitespace.
    • x in y becomes x∈y
  2. Handle any complex replacements before whitespace removal.
  3. Remove whitespace.
  4. Simple 1-to-1 substring replacements.
    • \alpha becomes α
    • Math.sin becomes sin
  5. Handle any complex replacements.
    • \frac{1}{2} becomes (1)/(2)
    • LaTeX matrices become arrays.