Using Go (golang) I\'d like to take a string with a formula and evaluate it with pre-defined values. Here\'s a way to do it with python\'s parser module:
parser
With this code you can evaluate dynamically any formula and return true or false:
package main import ( "go/token" "go/types" ) func main() { fs := token.NewFileSet() tv, err := types.Eval(fs, nil, token.NoPos, "(1 + 4) >= 5") if err != nil { panic(err) } println(tv.Value.String()) }