Documentation ¶ Index ¶ func Format(e Expr) string type Env type Expr func Parse(input string) (_ Expr, err error) type Var func (v Var) Check(vars map[Var]bool) error func (v Var) Eval(env Env) float64 Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func Format ¶ func Format(e Expr) string Format formats an expression as a string. It does not attempt to remove unnecessary parens. Types ¶ type Env ¶ type Env map[Var]float64 type Expr ¶ 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 } An Expr is an arithmetic expression. func Parse ¶ func Parse(input string) (_ Expr, err error) type Var ¶ type Var string A Var identifies a variable, e.g., x. func (Var) Check ¶ func (v Var) Check(vars map[Var]bool) error func (Var) Eval ¶ func (v Var) Eval(env Env) float64 Source Files ¶ View all Source files ast.go check.go eval.go parse.go print.go Click to show internal directories. Click to hide internal directories.