HomeTable of ContentsTbcParser
Math Parser Components

Parse Expressions at Runtime
Bestcode Math Parser Components parse and evaluate mathematical expressions
given as strings at runtime (aka formula parser). The expression can contain predefined or user defined variables and functions. When evaluation is requested, the parser compiles the expression into a parse tree. Further evaluations are made using this tree that represents the expression. The parser can optimize the tree by simplifying branches that evaluate to a constant. Upgrades are free for registered users. The math parser components are available in various versions for different platforms/languages.

Bestcode Math Expression Parser Components

Math Parser for Borland Delphi, C++ Builder Developers:

TbcParser is a VCL math expression parser component that is verified to work with Delphi and C++ Builder versions 4, 5, 6, 7, 2006, 2007, 2009, 2010, XE, XE2 (32 bit or 64 bit), XE3, XE4, XE5, XE6, XE7, XE8, Delphi 10 . Math Parser library comes as Delphi Pascal source code (Two separate versions: One for Delphi XE and another for pre-XE Delphi due to compatibility breaking changes in Delphi after XE).

Math Parser for Java Developers:

JbcParser is the Java version of the math expression parser component. Mathematical expression parser library comes as a zip with Jar, Java source code. It can be used with JDK 1.5 and later. It can also be compiled for Android projects.

Math Parser for .NET Developers:

bcParser.NET is the .NET (C#) version of the math expression parser component. Excellent match for .NET users. Visual Basic and C# examples included. (C# Source code included.) Math parser library comes as a DLL with C# source code.

Math Parser for Go:

bcParserGo is the Golang version of the math expression parser library. Supports Linux, OS X, Windows. bcParserGo math parser library comes as Go source code implemented in bestcode/mathparser package.

Math Parser for C++ Developers:

bcParserCPP is the Math Parser for C++. It comes as a CMathParser template class which you can include in any C++ project just like any other header file. CMathParser source code is portable across different compilers such as Visual C++, C++ Builder, GNU C++ and also across operating systems such as Windows, Linux, Mac OS. For advanced users, it can also provide numeric type flexibility due to C++ template capabilities and operator overloading by which you can define your own numeric types and plug them into the parser.

Math Parser for Objective C, iOS (iPhone), OS X:

bcParserObjC is the Objective C version of the math expression parser library. Excellent match for XCode, iOS and OS X users. Objective C example included. bcParserObjC math parser library comes as Objective C source code.

Math Parser for PHP Developers:

Math Parser for PHP is a PHP class to parse and evaluate math formulas at runtime without using the PHP eval() function for security reasons. bcParserPHP comes as a single mathparser.php source code.

Math Parser for Python Developers:

PyMathParser is a Python class to evaluate mathematical expressions at runtime. Unlike compiled languages, Pythonís eval() function makes life easy for us by doing the real parsing work. But there is still some work to make it secure. You can download PyMathParser for free.

Math Parser FAQ

Question: How can I use different number formats such as Hex, Binary etc besides decimal?

For example: 0xFE01 + 99 + #10011


You can write a regular expression based pre-processor that will find these different formats and replace them with decimal value equivalents before feeding the expression to the math parser.