Description
The Go Expression Toolkit (Go-ExprTk) is a wrapper library based on C++ Mathematical Expression Toolkit Library (ExprTk).
It is a simple to use, easy to integrate and extremely efficient run-time mathematical expression parser and evaluation engine.
Go-ExprTk supports numerous forms of functional, logical and vector processing semantics and is very easily extendible.
Go Mathematical Expression Toolkit alternatives and similar packages
Based on the "Text Processing" category.
Alternatively, view go-exprtk alternatives based on common mentions on social networks and blogs.
-
goldmark
:trophy: A markdown parser written in Go. Easy to extend, standard(CommonMark) compliant, well structured. -
bluemonday
bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS -
omniparser
omniparser: a native Golang ETL streaming parser and transform library for CSV, JSON, XML, EDI, text, etc. -
html-to-markdown
⚙️ Convert HTML to Markdown. Even works with entire websites and can be extended through rules. -
mxj
Decode / encode XML to/from map[string]interface{} (or JSON); extract values with dot-notation paths and wildcards. Replaces x2j and j2x packages. -
go-pkg-rss
DISCONTINUED. This package reads RSS and Atom feeds and provides a caching mechanism that adheres to the feed specs. -
go-edlib
📚 String comparison and edit distance algorithms library, featuring : Levenshtein, LCS, Hamming, Damerau levenshtein (OSA and Adjacent transpositions algorithms), Jaro-Winkler, Cosine, etc... -
goq
A declarative struct-tag-based HTML unmarshaling or scraping package for Go built on top of the goquery library -
go-pkg-xmlx
DISCONTINUED. Extension to the standard Go XML package. Maintains a node tree that allows forward/backwards browsing and exposes some simple single/multi-node search functions. -
github_flavored_markdown
GitHub Flavored Markdown renderer with fenced code block highlighting, clickable header anchor links. -
pagser
Pagser is a simple, extensible, configurable parse and deserialize html page to struct based on goquery and struct tags for golang crawler
InfluxDB - Purpose built for real-time analytics at any scale.
Do you think we are missing an alternative of Go Mathematical Expression Toolkit or a related project?
README
Go Mathematical Expression Toolkit
The Go Expression Toolkit (Go-ExprTk) is a wrapper library based on C++ Mathematical Expression Toolkit Library (ExprTk).
It is a simple to use, easy to integrate and extremely efficient run-time mathematical expression parser and evaluation engine.
Go-ExprTk supports numerous forms of functional, logical and vector processing semantics and is very easily extendible.
Installation
go get github.com/Pramod-Devireddy/go-exprtk
Examples
package main
import (
"fmt"
"github.com/Pramod-Devireddy/go-exprtk"
)
func main() {
exprtkObj := exprtk.NewExprtk()
defer exprtkObj.Delete()
exprtkObj.SetExpression("(x + 2)*(y-2)")
exprtkObj.AddDoubleVariable("x")
exprtkObj.AddDoubleVariable("y")
err := exprtkObj.CompileExpression()
if err != nil {
fmt.Println(err.Error())
return
}
exprtkObj.SetDoubleVariableValue("x", 18)
exprtkObj.SetDoubleVariableValue("y", 32)
fmt.Println(exprtkObj.GetEvaluatedValue())
}
Check out more Examples
⚡ Features
The Go-ExprTk library has the following capabilities:
Mathematical operators (+, -, *, /, %, )
Functions (min, max, avg, sum, abs, ceil, floor, round, roundn, exp, log, log10, logn, pow, root, sqrt, clamp, inrange, swap)
Trigonometry (sin, cos, tan, acos, asin, atan, atan2, cosh, cot, csc, sec, sinh, tanh, d2r, r2d, d2g, g2d, hyp)
Equalities & Inequalities (=, ==, <>, !=, <, <=, >, >=)
Assignment (:=, +=, -=, *=, /=, %=)
Logical operators (and, nand, nor, not, or, xor, xnor, mand, mor)
Control structures (if-then-else, ternary conditional, switch case, return-statement)
Loop structures (while loop, for loop, repeat until loop, break, continue)
Optimization of expressions (constant folding, strength reduction, operator coupling, special functions and dead code elimination)
String operations (equalities, inequalities, logical operators, concatenation and sub-ranges)
Expression local variables, vectors and strings
User defined variables, vectors, strings, constants and function support
Multivariate function composition
Multiple sequence point and sub expression support
Numeric integration and differentiation
Vector Processing: BLAS-L1 (axpy, axpby, axpb), all/any-true/false, count, rotate-left/right, shift-left/right, sort, nth_element, iota, sum, kahan-sum, dot-product, copy
❤️ Credits
This module could not be possible without the ExprTk library by Arash Partow and the idea of creating the wrapper module by Narayana Rao G S
Published under MIT License
*Note that all licence references and agreements mentioned in the Go Mathematical Expression Toolkit README section above
are relevant to that project's source code only.