Capstone B: an expression parser and a REPL
This part of the C# course is the second capstone: an expression language with a REPL. A lexer turns the text into tokens with positions, a recursive-descent parser builds a syntax tree, and an evaluator walks that tree. Errors a user can read, the REPL itself and a table of expressions with the values they produce close the part.
11.1
Capstone B: the tokens
a token type, a lexer, numbers and operators
Open
11.2
Capstone B: the parser
recursive descent, precedence, an error with a position
Open
11.3
Capstone B: the syntax tree
the tree, ToString, a round trip
Open
11.4
Capstone B: evaluation
an evaluator, division by zero, a result type
Open
11.5
Capstone B: errors a user can read
the position, the message, the exit status
Open
11.6
Capstone B: the REPL
Console.ReadLine, :quit, a running total
Open
11.7
Capstone B: testing and extending
a table of expressions and values, a variable
Open