Capstone B: an expression parser and evaluator

The second capstone of the Haskell course builds an expression parser and evaluator in eight lessons. A lexer turns the input into tokens, a recursive descent parser turns them into a tree, and an evaluator answers with a value or an error that carries a position. A REPL follows, then the tests over a table of expressions, and a variable added in the last lesson to show what a feature costs.

111 Capstone B: the tokens a token type, a lexer, numbers and operators Open 112 Capstone B: the parser a recursive descent parser, precedence climbing, an error with a position Open 113 Capstone B: the syntax tree an expression type, show for it, a round trip Open 114 Capstone B: evaluation an evaluator over the tree, division by zero, Either for the error Open 115 Capstone B: errors a user can read a position in the input, the message, the exit status Open 116 Capstone B: the REPL a loop over getLine, :quit, a running total of errors Open 117 Capstone B: testing the evaluator a table of expressions and values, the parser and the evaluator together Open 118 Capstone B: adding a feature a variable, an environment, the parser change and the tests that follow Open

Lessons