Description
TinyExpr is a very small C library for evaluating math expressions at run time. It is a recursive descent parser, compiler and evaluation engine in a single source file and a header file, so you can add it to a C project by copying two files. You give it a text expression such as sqrt(3^2+4^2), and it returns the result. It implements standard operator precedence and the usual math functions. The library is written in ANSI C with no dependencies, and the author describes it as simple, fast, thread-safe and easy to extend. The project includes examples and a test suite. It is released under the zlib license, which is permissive and allows almost any use, including commercial use, with the license's conditions. The sample code on the project page shows the library being included and called to print a result. TinyExpr is aimed at C developers who need to let users or configuration files supply formulas, such as calculators, simulations or graphing tools, without writing their own parser. The project is hosted on GitHub, and the author's blog describes the project and other work.…
Highlights
- Single C source and header file
- Evaluates math expressions from text
- No dependencies, ANSI C
- zlib license
Ratings & Reviews
No ratings yet
Be the first to rate Tinyexpr.
People also visit

MathParser.org-mXparser
Math Parser: Java, C#, C++, Kotlin, Android, and all .NET platforms
Tinyexpr FAQ
What is TinyExpr?
A small C library that parses and evaluates math expressions given as text.
Is it free?
Yes. The site says it is open source and free, released under the zlib license.
How do I add it to my project?
Include the single source file and the header file, then call te_interp with the expression.
Does it need other libraries?
No. The site says it is ANSI C with no dependencies.
Is it thread-safe?
The site describes it as thread-safe.
Does it support standard functions?
Yes. It implements standard operator precedence and common math functions.
What are the best Tinyexpr alternatives?
Popular alternatives to Tinyexpr include ExpressionEvaluator, MathExecutor and MathParser.org-mXparser. See all Tinyexpr alternatives


