This is a parser/lexer for mathematical expressions.
It all starts with the parse/1
function, which begins by
building an array (in a rather ineffecient way) from the
iterator returned by lex/2
. The lexer is the part of this
I had the most fun with.
It basically brute-forces the beginning of the string with regex until something matches up, at which point it removes that match from the string and yields the token.