Documentation ¶
Overview ¶
Package eval provides an evaluator for arithmetic intermediate representation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator evaluates an arithmetic program.
func NewEvaluator ¶
NewEvaluator constructs an evaluator with empty state.
type Processor ¶
type Processor interface { // Bits returns the word size of the processor. Bits() uint // Const builds the n-bit constant with value x. Const(x uint64, n uint) Value // ITE returns x if l≡r else y. ITE(l, r, x, y Value) Value // ADD is addition with carry in/out. ADD(x, y, cin Value) (sum, cout Value) // SUB is subtraction with borrow in/out. SUB(x, y, bin Value) (diff, bout Value) // MUL is multiply with upper/lower parts of the result. MUL(x, y Value) (hi, lo Value) // SHL shifts left by s. SHL(x Value, s uint) Value // SHR shifts right by s. SHR(x Value, s uint) Value // Errors returns any accumulated errors. Errors() []error }
Processor is an implementation of the arithmetic instruction set.
Click to show internal directories.
Click to hide internal directories.