Define a new concrete type that satisfies the Expr interface and provides a new operation such as computing the minimum value of its operands.
Since the Parse function does not create instances of this new type, to use it you will need to construct a syntax tree directly (or extend the parser).
type Expr interface {
// Eval returns the value of this Expr in the environment env. Eval(env Env) float64// Check reports errors in this Expr and adds its Vars to the set. Check(vars map[Var]bool) error// String returns a human readable string of the Expr String() string
}
Parse parses the input string as an arithmetic expression.
expr = num a literal number, e.g., 3.14159
| id a variable name, e.g., x
| id '(' expr ',' ... ')' a function call
| '-' expr a unary operator (+-)
| expr '+' expr a binary operator (+-*/)