如何将latex转换为可以在JS或PHP中计算的字符串

I'm using mathquill that allows users to enter equations and save them. the output from mathquill is LaTex, how would one go about parsing this to an expression that can be evaluated.

var mathFieldSpan = document.getElementById('math-field');
var latexSpan = document.getElementById('latex');
var MQ = MathQuill.getInterface(2); // for backcompat
var mathField = MQ.MathField(mathFieldSpan, {
    spaceBehavesLikeTab: true, // configurable
    handlers: {
        edit: function() { // useful event handlers
            latexSpan.textContent = mathField.latex(); // simple API
        }
    }
});

https://npmmirror.com/package/algebra-latex
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Example
const AlgebraLatex = require('algebra-latex')

// Parse from LaTeX ...
const latexInput = '\frac{1}{\sqrt{2}}\cdot x=10'
const algebraObj = new AlgebraLatex().parseLatex(latexInput)

// ... or parse from regular math string
const mathInput = '1/sqrt(2)*x=10'
const algebraObj = new AlgebraLatex().parseMath(mathInput)

console.log(algebraObj.toMath()) // output: 1/sqrt(2)*x=10
console.log(algebraObj.toLatex()) // output: \frac{1}{\sqrt{2}}\cdot x=10