Documentation ¶ Index ¶ 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 func (v Var) String() string Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Env ¶ type Env map[Var]float64 type Expr ¶ type Expr interface { Eval(env Env) float64 Check(vars map[Var]bool) error String() string } func Parse ¶ func Parse(input string) (_ Expr, err error) 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 (+-*/) type Var ¶ type Var string func (Var) Check ¶ func (v Var) Check(vars map[Var]bool) error func (Var) Eval ¶ func (v Var) Eval(env Env) float64 func (Var) String ¶ func (v Var) String() string Source Files ¶ View all Source files binary.go call.go i_eval.go literal.go parse.go unary.go var.go Click to show internal directories. Click to hide internal directories.