Equation Parsing Library C++ [closed]

半世苍凉 提交于 2019-12-03 08:58:44

问题


I'm sure there must be something like this somewhere but I can't seem to find anything useful on here or Google. I had hoped Boost might have something but alas not.

What I'm after is a lightweight library that can take a string from the user, for example "y=2x+3" and parse it returning an object or function which returns y when given x.

Can anybody recommend something for this? (Worst case I could write one myself but no point reinventing the wheel and all.)

Things which can be assumed if necessary;

  • Preset variable names
  • Number of variables fixed

回答1:


MuParser is all you ever could wish for. You can even define custom operators, store and evaluate the expressions in binary form, etc... Written in C++, bindings for C and C# (and maybe even other languages).



来源:https://stackoverflow.com/questions/9503455/equation-parsing-library-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!