Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorParenthesis = fmt.Errorf("mismatched parenthesis") ErrorUnknownSymbol = fmt.Errorf("unknown symbol") ErrorEmptyString = fmt.Errorf("cannot parse empty string") ErrorNotEnoughArgs = fmt.Errorf("no args in function call") )
View Source
var (
ErrorVariableNumeric = fmt.Errorf("trying to use variable as numeric")
)
View Source
var (
ErrorZeroDivision = fmt.Errorf("can't divide by 0")
)
Functions ¶
func CalculateExpression ¶
CalculateExpression returns the numerical value of the input expression or an error in case something went wrong.
Types ¶
type Constant ¶
type Constant struct {
Value float64
}
Constant represents a numeric constant expression
type Operation ¶
type Operation struct { // can be constant, variable, func or operator Operator Operator // operands Left *Operation Right *Operation }
Operation is a binary tree containing the operands and the operation to perform
func PostfixToTree ¶
PostfixToTree translates a postfix expression into a binary tree data structure that can operate the expression.
type SimpleOperator ¶
type SimpleOperator struct {
Type byte
}
SimpleOperator represents basic operators such as addition, subtraction...
func (*SimpleOperator) LaTeX ¶
func (o *SimpleOperator) LaTeX(x, y *Operation) string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.