x/debug: add an expression evaluator.
The evaluator parses the expression with go/parser, then walks through
the resulting syntax tree, evaluating the subexpression at each node.
The expression can include local and global variables. The program
counter and stack pointer of the stopped program are used to determine
what variables are available, and their location in memory.
The returned result uses the same types as the program.Value function.
The math/big package is used to represent untyped numeric constants.
A go generate rule using the m4 preprocessor is used to produce eval.go.
Reviewed-by: Dave Day <email@example.com>
Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org>
9 files changed