goexpression

所属分类:数值算法/人工智能
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2020-05-29 02:16:59
上 传 者sh-1993
说明:  golang中的表达式解析器和计算器
(expression parser and evaluator in golang)

文件列表:
res/
scanner/
LICENSE.txt
Technical.md
eval.go
eval_test.go
parse.go
parse_test.go
parsebranches.go
tokens.go
treenode.go
treenodehelper.go

# Go Expression Version: 0.01 Alpha MIT License (MIT) go expression is a basic math expression parser and evaluator. This project is in alpha phase and may change significantly in the near future. The purpose is to learn go and use the expression parser in other projects. ## Status **Supported** - Basic Math Operators like '+', '-', '*', '/' - Operator precedence, Ex: 1+2*3 = 1+6 = 7 - grouping () Ex: (1+2)*3 - variables Ex: 1+x where x is passed as a variable to Eval. - only parsing works for; - Define a variable Ex: x=6 **Parsing only** - Text values inclused in qoutes. - Functions with arguments, ex: myfunc(1,2) - Boolean types and expressions like '==', '<', '>', '!', 'and', 'or' **Planned** - Special keywords like. if, each, etc - Calling go functions from the expression ## Basic usage context := map[string]interface{}{ "x": 5, "y": 21, "z": 12.5, } ans:=goexpression.Eval("1+x*(50-y)/z", context) fmt.Printf("=%v",ans)

近期下载者

相关文件


收藏者