Desmos uses Pratt Parsers (2018)

Parsing is the process of converting a string of characters into an abstract syntax tree (AST), which represents the structure of an expression. At Desmos, they use Pratt Parsing to create an AST, which is a method that uses binding power to guide the parsing process. The Pratt parser approach has several advantages over other methods such as customizable error messages, developer-friendliness, type-safety, code reuse, and smaller bundle size. The Pratt parser implementation is also faster than traditional methods. However, there are some disadvantages to using a Pratt parser, such as the potential for running out of call stack space for deeply nested expressions.

https://engineering.desmos.com/articles/pratt-parser/

To top