class
EEEval::CalcFuncParser
- EEEval::CalcFuncParser
- Reference
- Object
Defined in:
eeeval.crClass Method Summary
-
.build_ast(tokens : Array(Token)) : AST::Node
----------------------------------------------------------------------- build_ast(tokens) — public access to the AST builder.
-
.compile(expression : String) : AST::Node
----------------------------------------------------------------------- compile(expression) — parses the expression once and returns the AST.
-
.evaluate(expression : String, vars : Hash(String, Float64)) : Float64
----------------------------------------------------------------------- evaluate(expression, vars) — evaluates with user-defined variables.
-
.evaluate(ast : AST::Node, vars : Hash(String, Float64)) : Float64
----------------------------------------------------------------------- evaluate(ast, vars) — evaluates a pre-compiled AST with an environment.
-
.evaluate(ast : AST::Node, vars : Hash(String, Tensor(Float64, CPU(Float64)))) : Tensor(Float64, CPU(Float64))
----------------------------------------------------------------------- evaluate(ast, vars) — evaluates a pre-compiled AST with a Tensor environment.
-
.evaluate(expression : String) : Float64
----------------------------------------------------------------------- evaluate(expression) — backward-compatible single-argument form.
-
.tokenize(expression : String) : Array(Token)
----------------------------------------------------------------------- tokenize(expression) — public access to the tokenizer.
Class Method Detail
build_ast(tokens) — public access to the AST builder. Converts a pre-tokenized Array(Token) into an AST::Node tree.
compile(expression) — parses the expression once and returns the AST. Use this when the same expression will be evaluated many times with different variable values (e.g. CLI range, plotting, benchmarks).