## Description

I first joined Photomath as a content creator, solving mathematical problems that were too difficult for *PM Solver*, a Mathematica-like proprietary software. PM Solver creates step-by-step solutions to simple mathematical problems. For more difficult problems, content creators help PM Solver by, for example, setting up equations from a “word problem”. The difficulty is that content creators write mathematics in LaTeX, whereas PM Solver has its own syntax, so a lot of time was wasted doing error-prone syntax conversions by hand.

Deciding to resolve the problem, I wrote a transpiler which converts LaTeX into PM Solver syntax; similar to how TypeScript gets converted into JavaScript. Photomath adopted this solution and hired me into the web development team. The transpiler is still used by thousands of people as of 2021.

## Example

Consider the following LaTeX expression:

\begin{aligned} \sin{x}+\cos{y}=\frac{1}{2}\\ \frac{x^2+10x+2}{10y}+y=5 \end{aligned}

When rendered, it produces:

A content creator might want to solve this system of equations. Without the LaTeX transpiler, solving it would involve writing PM Solver syntax by hand. But with the transpiler, the following PM Solver input is automatically generated:

system(sin(x)+cos(y)={{1}/{2}},{{x^2+10x+2}/{10y}}+y=5)

## Technologies

The project core relied on formal language theory, namely context-free grammar and parser generators. However, the core needed to be embedded within an editor as can be seen on the picture at the start of this page, thus a lot more tooling was required.

The following technologies were used:

- React
- MobX
- Semantic UI
- Webpack, Jest, Node.js