I'm using LaTeX for a project I'm working on where the input will be in LaTeX form, but I need the LaTeX input to be converted to glsl. The problem is that LaTeX has so many little "edge cases" where the parsing and converting code would be incredibly tedious to hardcode (by hardcode I mean write a bunch of ifs to handle every little case). Is hardcoding every little nuance of LaTeX "grammar" the only way for me to do this?
For example:
This \sin\left(x^{2^x}\right) should convert to this sin(pow(x, pow(2, x)) .