Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Expr ¶
type Expr interface { Eval(env Env) float64 // Check reports errors in this Expr and adds its Vars to the set. Check(vars map[Var]bool) error fmt.Stringer }
func Parse ¶
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 | 'min' '(' expr ',' expr ')' the min operator, e.g., min(1, 2) => 1 | id '(' expr ',' ... ')' a function call | '-' expr a unary operator (+-) | expr '+' expr a binary operator (+-*/)
Click to show internal directories.
Click to hide internal directories.