Evaluate formula in Go

前端 未结 8 1018
梦如初夏
梦如初夏 2021-01-02 12:46

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:

<
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 13:11

    I have made my own equation evaluator, using Djikstra's Shunting Yard Algorithm. It supports all operators, nested parenthesis, functions and even user defined variables.

    It is written in pure go

    https://github.com/marcmak/calc

提交回复
热议问题