Paint Programs
Photo Editors
Photo Galleries
Image Viewers
Image Resizers

Icon Extractors
Icon Editors

3D Images
3D Text
3D Images Stereograms

Image Tools
Screen Recorder SW Box Covers

Code Librarians
Equation Parsers
Code Editors
Text Editors
Hex Editors
Hex Viewers
Help Authoring

HTML Editors
Internet Radio


Shell Extensions
Sticky Notes
ToDo List
Folder Printers
Folder Sizing


GBIC >> Software Reviews >> Equation Parsers
Equation Parsers      (July 2007)

Equation Parsers, also known as math parsers or expression evaluators, are used to solve equations entered as a text string at run time, rather than hardcoding the equation into the application. The parsers interpret (parse) the equation, then use variable values to evaluate the equation. Parsers are typically distributed as DLLs, OCXs, or source code.

Of the 20+ available equation parsers, there are about twice as many commercial as freeware versions. Commercial parsers are generally easier to insert into applications. Freeware excelled in performance, where 3 of the top 4 speeds were turned in by freeware parsers.

In addition to dedicated parsers, equation parsing capabilities are also available in more generalized software, such embeddable scripting language libraries and ActiveX spreadsheet components.

Review Results
The basics of all parsers are pretty much the same - add a DLL/OCX to an application, define custom functions/variables, define the equation to solve, set variable values and then evaluate the equation. Parsers vary greatly in the number of built-in functions, documentation completeness, availability of sample insertion code examples, and speed. Even though most parsers allow the user to create custom functions, a greater number of built-in functions makes implementation simpler on the programmer. All of the parsers were fairly easy to implement, with most requiring less than 10 lines of code (which is good, because documentation on implementation code is not a strong point for most parser authors). The greatest difference between parsers was in speed, with over 1000X difference between the slowest and fastest parsers.

From the full list of equation parsers, here are the four parsers with the highest speeds:

  • MTParser            2.5 Mips, $0, 2007      (batch mode available for greater speeds)
  • uCalc                  2.5 Mips, $0, 2007      (next version to be commercial, $600)
  • muParser           2.5 Mips, $0, 2007
  • CioinaEval          2.1 Mips, $0, 2003

1. The website of a top performer, EquTranslator (2.8 Mips, $495, 2007), has recently gone offline.
2. muParser data from newly released, VB6-compatible DLL (July 2007)
3. MTParser batch data from newly released, VB6-compatible batch mode DLL routine (July 2007)

    Bottom Line: The differences between the top three performers (uCalc, MTParser, and muParser) are very minimal. Although uCalc is freeware, it is also part of a line of commercial products, so many users will want the assurance of responsive support and continued development that it represents. Both MTParser and muParser are mature freeware products with active online support from their authors, so users who prefer freeware can feel comfortable using either of these.

    Note that MTParser offers a batch mode for transferring variable values. This mode gives 10%-140% speed improvements over competing parsers, depending on the complexity of the equation. If you can use the batch mode, then MTParser offers you the fastest speeds available, particularly on equations of lower complexity.

Additional Review Comments
Speed (measured in Million iterations per second) testing was done on a Gateway Intel Core 2 Duo E6400 PC (2.11GHz), using a compiled VB6 test program to test parsers on five equations of varying complexity. The results above represent the most complex equation tested, "abs(sin(sqrt(x^2+y^2))*255)". At lower complexities, speeds were 2X-3X faster, as seen in the complete speed results.

There are two speeds measurements of interest - time to first equation evaluation and speed of iterating subsequent evaluations. The latter is the most common usage of equation parsers and is the speed measured in this review.

This review focused on parsers capable of being used in multiple languages. Other parsers that were reviewed include source code (VB6, Delphi, and Java), ActiveX objects (commercial spreadsheet OCXs), the Eval() function (from JavaScript and VBA), and general purpose embeddable scripting languages. Most of these other parsers offer lower speed solutions, but provide other advantanges that a programmer might find useful.

I've also put together an Excel spreadsheet that provides all the information, and more, found on this page. I welcome any feedback from users on additional information they need to evaluate parsers for their needs.

One question not answered in this review is performance of the parsers in other languages. As an update to this page, I am working on testing the parsers in VC++ and C#.

Key Parser Issues
In addition to speed, there are several factors user will want to consider in selecting a parser.

  • Speed
  • The operators/functions used in an equation can make a huge difference in performance speeds, between competing parsers or even within an individual parser. When speed is critical, be sure to try out equations that are representative of your needs to make sure you get the parser best suited to providing you with optimum performance. For example, exponential and trigonometric functions are often handled much slower than other more common functions. For my review I use an equation of moderate complexity - "abs(sin(sqr(x^2+y^2))*255)".

    Note that there are two parser speed parameters of interest, the time to compile an equation and the time to evaluate an equation.

    For applications needing to evaluate a single equation millions of times, typically with new variable values on each iteration, compilation can significantly reduce the time to complete all iterations, even though the first equation is slower due to compilation time. My review did not measure the speed of compilation, which could be important in applications which need to compile/evaluate many different equations. I will likely expand the review later to cover this issue.

    In my speed tests, which combine compilation and evaluation, parser speeds ranged from a very low 0.002 Mips (million iterations per second) to a high of over 10 Mips. The highest speeds are achieved with only the simplest of equations. As equation complexity grows, the highest performing parsers generally achieved 2-3 Mips results.

    For evaluating an equation with a single set of variables, even the slowest parsers work well in most applications. Even at 0.002 Mips the user will interpret a single iteration as taking place instantly.

    However, for compiling an equation once only, then performing millions of iterations of variable assignment and equation evaluation, only the highest performing parsers (2-3 Mips) will can begin to give users a sense of speed.

    For example, to modify a single 1280x1024 image "instantly" (in about 1/4 second), a parser speed of about 5 Mips is needed. This means that the best parsers can approach speeds that users will consider fast.

    For limited animation speed/resolution, such as 15fps of 640x480 images, an overall speed of 5 Mips is required - close to the capabilities of the best parsers. However, at 30 fps animation of 1280x1024 images, a parser speed of 40 Mips is needed - well beyond the speeds available from the parsers available today.

  • Documentation
  • There were a few parsers which provided lengthy documentation. But as a group parser documentation is poor - particularly lacking in summary/overview information and in providing adequately commented sample source code in all of the languages the parser supports. VB source code was particularly hard to find.

    I was especially disappointed to find that almost none of the parsers provided a complete, convenient, online summary/listing/definition/syntax of the parser objects and their interface (properties/methods).

    The good news is that most parsers require only a few lines of code to implement. So, the lack of documentation, while frustrating, is not that hard to covercome.

  • Application Language
  • The language used to write the application which uses the parser can also be a factor in the parser performance. All of my testing was done using the parser DLLs/OCXs in a VB test program, but parsers do not always perform the same in each of the most popular languages (C++, Delphi, VB, VB.NET). Unfortunately, the authors do not usually address these performance issues. If you have the option of using more than one language for your application, you'll want to consider running tests to make sure you know how well the parser performs in your language.

  • Author Support / Active Development
  • Before you commit your product to using a parser you'll want to know how mature the product is and whether bug fixes/improvements will be available. Almost 50% of the commercial parsers have been updated in the last year, whereas only about 20% of the freeware parsers have had updates with the last year. In both categories, however, author support continues to be available for most of the parsers, especially the top performing parsers.

  • License Limitations
  • Most programmers want to pay a single fee which allows them to freely use the parser in any/all of their applications. This type of license is generally provided, but there are some very specific exceptions. Be sure to read the parser licensing agreement to make sure it fits your needs.

  • Supported Functions
  • Pretty much all parsers handle a common set of core operators and functions. However, there are some parser differences which might drives a user's choice - such as extended precision, complex numbers, or other math functions specific to a particular scientific discipline. Most parsers also offer the ability to add custom operators/functions.

    A side-by-side summary of parser-supported functions is available online.

Full List of Equation Parsers
The follow parsers were reviewed. Freeware programs are listed in alphabetical order and commercial programs are listed from least to most expensive.

The speed column is in million iterations per second (Mips). Speed tests were performed on my Gateway E6400 Dual Core Pentium PC. This table has only the speed results for the equation "abs(sin(sqr(x^2+y^2))*255)", but speed results on all five test equations are presented further down this page.

If you're aware of a product I've missed, please let me know. Or, if you're aware of an aspect of a program that you think I should consider in selecting a program, feel free to let me know that too.

TitleAuthorCost     File   Speed
dotMath Library
Steve Herbert-0-DLL in work ...
.NET Expression Evaluator
Pascal Ganaye-0-DLL in work ...
Lua Scripting Language
PUC-Rio-0-DLL 1.2
Mathieu Jacque-0-DLL 2.5
Ingo Berg-0-DLL 2.5
Daniel Corbier-0-DLL 2.6 (1)
Windows Script Control
Microsoft-0-OCX 0.024
AxEval AxisPackage Software$10DLL 0.0001
bcParser$20DLL 0.55
Marianne Goeltl-Schuberth  $27DLL 0.20
Encore Consulting$62OCX 0.09
Equation Parser Library
Effective Objects$70DLL 0.47 (2)
Alexei Cioina$99DLL 2.1
Precision Expr Evaluator
Precision$116OCX 0.16 (3)
#Calculation Component$159DLL 0.0014
Unisoft Plus$247DLL 1.4 (4)
Easy Math Solution$495DLL 2.8
Daniel Corbier$600DLL 2.6


    (1) uCalc v2.9 is currently a free product. v3.0 will return

    (2) EffObjects Equation Parser Library trial was only available as a compiled EXE, which I used to get these test results.

    (3) Precision Expression Evaluator trial gives a popup for each iteration in a loop, preventing testing of million+ loops. However the author provided a temporary license to use for purposes of this review.

    (4) USPExpress trial version provides limited functionality, so the speed test had to be run on a different equation.

Complete Speed Test Results
The following code snippet shows the Visual Basic source code used for the hardcode test. The code is commented to show where code is added to get parser-specific results.

    'parser initialization/compile code goes here
    For y = 1 To 2000
    For x = 1 To 2000                   
	'parser variable assignment / equation evaluation goes here
        Result = abs(Sin(Sqr(x^2 + y^2))*255)  'hardcoded example
    Next x
    Next y

I used code similar to this, along with parser-specific code, to generate the parser speed test results. Five equations of varying complexity were used:

  1. x*2+y*2
  2. sin(x)+sin(y)
  3. x^2+y^2
  4. abs(sin(sqr(x^2+y^2))*255)
  5. abs(sin(sqr(x*x+y*y))*255)

And here are the results of the speed tests for each parser and for each equation.

dotMath Librarytbdtbdtbdtbdtbd.NET test needed
Expression Evaluatortbdtbdtbdtbdtbd.NET test needed
Lua Scripting Language4.
MTParser (batch)
Windows Script Control0.0260.0260.0260.0240.024
Equation Parser Library1.21.00.860.470.53author EXE used
Precision Expr Evaluator0.
#Calculation Component    0.00250.00180.00240.00140.0013
USPExpress4.42.3~1.8~1.21.4trial version limitations
Web Page Solutions-------
JavaScript Eval()0.0200.0200.0200.0150.016
JavaScript non-Eval()tbdtbdtbdtbdtbd
VB6-Only Solutions-------

Other Parsers
The parsers discussed above are capable of being used in multiple languages. There are other parsers options available. These include uncompiled source code which supports a single language (VB.NET, Delphi, JavaScript or Java). Equation parsing capabilities are also available as secondary features of ActiveX components (such as spreadsheet components) and scripting engines. This section discusses these other types of parser options. I include speed test results, where available.

  • VB6-only Parsers (source code) These parsers are source code which may be inserted into a VB6 program to provide parsers functions. Their speeds will be low, but still fast enough for many applications. Plus, the offer the flexibility of being able to modify the code for improvements and bug fixes.

    Note: The speed quoted for the Simple Expression Parser is for the simplest test equation. I was unable to get the parser to work on the other, more complicated test equations. Also, Eval for VB trial was only available as a compiled EXE which could not loop, so I had to use a custom EXE supplied by the author.

  • Delphi-only Parsers (source code) In late '90s a number of Delphi-specific (Pascal) parsers appeared. Most of these seem to be derivations of one another, starting with the original work by Hoffmeister. The documentation on these indicate that good speeds were attained, but I've seen no specific numbers and I do not have Delphi to test the approaches.

  • Java-only Parsers (source code) These solutions provide equation parsing capabilities for web pages. I've yet to test these for performance.

    • JFormula by JAPISoft ($733, 2006)
    • JEP by Singular Systems ($350, 2007)
    • Math Parser by Hussm Al-Mulhim ($0, 2005)

  • Excel Objects
    If your programming language supports inclusion of an Excel object, you can use Excel's capability to enter and evaluate equations.

  • ActiveX Spreadsheets
    There are commerical spreadsheet ActiveX components which provide Excel-like cability to enter and evaluate equations. While I did not include such components in this review, it's worth noting that they exist.

    I did test one such component, Formula One, which I've used for years. At 0.3 Mips, its performance was low, but if you already own the tool then the parser capability is free and the product is very mature.

  • Built-In Eval() Function
    Many languages or scripting engines have a builtin function, usually called Eval(). The function is usually not a high performing parser, but when available can be very useful while avoiding the need for embedding a third party parser.

  • JavaScript Eval() Function
    Using the Eval() function built into JavaScript you can add equation parser functionality to your web pages. The problem with using the Eval() function is that the equation has to be entered using JavaScript syntax, which is not always the same as a user is used to seeing. For example, to x^2 must be entered as Math.pow(x,2), or sin(x) must be entered as Math.sin(x). By my tests, speed performance is in the 0.2 Mips range.

    Here are some online examples using this approach. You'll have to use your browser's View - Page Source menu option to see the JavaScript code.

  • JavaScript - without Eval() Function
    Using JavaScript programming it's also possible to create a parser (without using the Eval function) which allows users to enter equations in more typical format. Source code would be similar in concept to the freeware/commercial parsers discussed elsewere in this review.

    Here are some online examples using this approach. You'll have to use your browser's View - Page Source menu option to see the JavaScript code.

  • VBA
    VBA is a scripting language built into several Microsoft products. It provides an Eval() function, which is a built-in equation parser. You can declare a link to the vba.dll to add access to the Eval() function from your own applications. I've seen the code available on the web but have not evaluated it myself.

  • Scripting Engines
    There are a number of products available, designed to allow programmers to add scripting capabilities to their applications. The Microsoft Windows Script Control and the Lua Scripting Language products (part of this review) are examples. Both of these can be used to provide scripting capabilities to users. The Microsoft Windows Script Control parsing speed is very slow (0.024 Mips), whereas the Lua Scripting Language DLL provides relatively fast (0.88 Mips) parsing capabilities.

Review Notes
While collecting information about the parsers, I've taken the following freestyle notes on most, but not all, parsers (placeholders had been added to remind me to adds some comments as soon as possible).

  • dotMath Library
    OpenSource expression compiler for the .NET platform written in C#. 1997-2007. Missing a short "Features" list. Has a "Getting Started" section online. Author "prefers not to be contacted". Function list seems short, perhaps not fully documented. Did not find documentation for parser interface (properties/methods).

  • Expression Evaluator
    Good documentation. VB.NET and C# source code examples. I'm not sure I understand this "By default, the evaluator does not define any function or variable anymore.". I've asked the author for help in generating speed test data.

  • Lua Scripting Language
    Lua is actually a DLL written to provide an embeddable scripting capability for applications. It also can be used for equation parsing, and provides performance better than most parsers, but not quite as good as the best. Documentation is extensive. There are several books published on using Lua. MIT license applies.

  • MTParser
    Very good documentation, including source code. Very good discussion on how parser works, how to optimize.

  • muMathParser
    The author has graphs showing very high performance, but there's no sample VB code to help me performan an insertion (lots of C++ code, however). Overall the documentation seem pretty complete.

  • uCalc
    The author has taken a daring step - offering what is basically a $600 package for free. He hopes to generate a lot of user feedback to help improve the product for its next commercial release. I've given him a lot of feedback. Bottom line is that the product is fast but more documentation is needed to help newbies get started and to understand how to optimize performance. He's already started responding with more insertion details on his web site. Some specific features are not operational in the trial, but none that are critical to most users.

  • Windows Script Control

    Old release date and default support for VBS - which means IE only, since Firefox/Opera do not support VBS. There's no clarification that JScript differs from JavaScript. Generally hard to work through the documentation.

  • AxEval
    No online documentation, download Help minimal/incomplete. Have to depend on examples for coding reference.

  • bcParser
    Download documentation is better than online information. Straightfoward product, readsonable set of basic functions.

  • TFunctionParser
    Download documentation is better than online information. Pretty full list of functions, including Statistics, Bessel functions, Integral, and Gamma functions.

  • ecMathExpr
    A single page of online description/documentation. The downloaded Help file is much better but you have to use the sample projects to get insertion instructions.
  • Equation Parser Library
    No online doc, but PDF has good content. Good code examples, simple to use. Limited built-in functions.

  • CioinaEval
    No online documentation, minimal description.

  • Precision Expression Evaluator
    The two trial downloads install different OCXs. Don't know why. The interface can be very simple, but there's no equation compilation. Even though the interface is simple, the Help file still doesn't give much help. There needs to be more discussion and sample code.

  • #Calculation Component
    Setup.exe to install. Minimal online info. Help file is almost good - there are no instructions on inserting parser into application (must view examples that were installed on PC). Interface (mthods/properties) covered well.

  • USPExpress Math Parser
    Setup.exe to install. Excellent Help file. Easy to follow instructions on inserting into application. Trial version only allows - * operators. User interface is very simple - variable definitions plus just 2 interface methods. Trial version operators limited to "+" (plus) and "*" (multiply)

  • EquTranslator
    Just unzip and use. Online content is limited. PDF file is reasonably good but gives little insight on how to optimize performance. C++, Delphi, VB6 examples are provided. The trial has a popup on first use plus the "-" (minus) operator is not supported.

  • clsMathParser
    Limited to VB (source code), with good documentation and examples.

  • Simple Expression Parser
    Demo code only on CodeProject - no functions, requres significant user work to create end-product.

  • Eval for VB
    Demo (EXE implementation of source code) is not helpful in assessing the performance. Help (Demo version) is very limited.

  • CalcExpress
    CalcExpress is now free, and is source code only (no DLLs). Delphi and C++ Builder are the target languages. There's no support for testing CalcExpress in VB6, so I've sent the author a request for help in getting speed data.

  • TExpressionParser, TExpress, TFormulaCompiler, TParser
    Delphi versions to which I don't have access.

  • JFormula, JEP, Math Parser
    Java code I can access, just haven't done it yet.

Parser Insertion Code & Include Files
This section links to the source code used to implement the parsers and summarizes the files (included in the parser installation package) that had to be included in the VB test program.

The VB6 source code used for testing is available. It includes an example of the minimum code required to implement the parser and also includes the complete VB6 code used in the speed test project (not including the parser DLLs/OCXs or author-provided .BAS/.CLS files).

If anyone can see where the code I used in any way limited the parser's performance, please let me know - including your suggestions on how to get increased performance.

  • clsMathParser
    - clsmathparser.cls and mMathSpecFun.bas (102K, 51K)
  • MTParser
    - mtparsercom.dll (272K)
  • muParser
    - muparser.dll (132K)
  • uCalc
    - ucalcE29.dll, ucalcF29.dll and ucalcvb,bas (40K, 109K, 35K)
  • AxEval
    - axeval.dll (172K)
  • bcParser
    - bcParser.dll (140K)
  • Cioina
    - cioina.dll and cioina.bas (220K, 16K)
  • Precision Expression Evaluator
    - expressionevaluator.ocx (56K)
  • #Calculation Components
    - sharpcalculation.ocx (107K)
  • USPExpressParser
    - uspexpressparser.dll (276K)
  • EquTranslator
    - equtranslator.dll and equtranslator.bas (124K, 2K)
  • Simple Expression Parser
    - expval.bas (18K)
  • Eval for VB/VBCE
    - uses .BAS files, but not available from author

Author Recognition
I'd like to acknowledge the support of several of the equation parser authors.

  • Daniel Corbier (uCalc)
    for his release of uCalc 2.9 as freeware and his tireless answering of my questions, and for not getting mad at me for a string of recommendations on his product and web site

  • Ingo Bert (muParser)
    for providing a re-compiled version of muParser compatible with VB6 and for supporting speed improvements for VB6 users

  • Mathieu Jacques (MTParser)
    for his interest in providing VB6 speed improvements of MTParser

  • Tuomas Salste (Eval for VB/VBCE)
    providing a compiled test version of his source code product, and for his insight on iterating on equation, rather than variable, changes

  • Peter Bessonov (AxEval)
    answering questions and for letting me know about the Lua Embeddable Scripting Language

  • Jianhua Li (#Calculation Component)
    For the additional VB6 source code examples

Other URLs
I found several other URLs which have information on equation parsers. I didn't use information from these sites, but they may be of use to you in gaining a greater understanding of parser code/concepts.

I especially liked this short summary of parser concepts.

Other interesting sites include: