A look inside the complex grapher

Enter a mathematical expression in the box below:

z

Below is the string the program receives from the math input box above, in LaTeX:

A lexer tokenizes the strings, and a parser generates an abstract syntax tree (AST) representing the expression. From the AST, the program rewrites the tree into a GLSL function that can be run in a WebGL fragment shader:



    

Finally, WebGL uses the generated shader to display the correct colors to an interactive HTML5 canvas element: