Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BigInt ¶
func (BigInt) Format ¶
func (i BigInt) Format()
The fmt package looks for Formatter before Stringer, but we want to use Stringer only. big.Int and big.Rat implement Formatter, and we embed them in our BigInt and BigRat types. To make sure that our String gets called rather than the inner Format, we put a non-matching stub Format method into this interface. This is ugly but very simple and cheap.
type Context ¶
type Context interface { // Lookup returns the value of a symbol. Lookup(name string) Value // AssignLocal binds a value to the name in the current function. AssignLocal(name string, value Value) // Assign assigns the variable the value. The variable must // be defined either in the current function or globally. // Inside a function, new variables become locals. Assign(name string, value Value) // Push pushes a new frame onto the context stack. Push() // Pop pops the top frame from the stack. Pop() // Eval evaluates a list of expressions. Eval(exprs []Expr) []Value }
Context is the execution context for evaluation.
Click to show internal directories.
Click to hide internal directories.