Math ParserTable of ContentsDelphi Example
TbcParser VCL Component

We all love Delphi & C++ Builder TbcParser is a math expression parser VCL component that can be used with Delphi and C++ Builder 4,5,6,7, 2006, 2007, 2009, 2010, XE, XE2, XE3, XE4, XE5, XE6, XE7, XE8, Delphi 10 Seattle, 10.1 Berlin, 10.2 Tokyo, 10.3 Rio, 10.4 Sydney and most likely any newer version.

TbcParser is compatible with 32 bit and 64 bit Delphi / C++ Builder. It is also compatible with iOS Delphi development. For Free Pascal users, it works in Lazarus IDE as well.

This formula parser Delphi component makes it possible for your application take user input as a formula to evaluate at runtime. It makes it possible to write scientific, financial, engineering applications in a flexible way without having to hardcode mathematical expressions. We have a few sample screenshots of applications that use TbcParser below.

Delphi Math Parser Component

TbcParser Delphi Math Parser Component features include:

  • Easy to use component API for Delphi and C++ Builder.
  • Comes with predefined functions.
  • You can create custom functions/variables and get a callback to your own functions that you define in your source code.
  • OnVariableFound event to provide values for undefined variables.
  • Optimization: Constant expression elimination for repeated tasks.
  • Analytic Operators: +, -, /, *, ^
  • Logical Operators: <, >, =, &, |, !, <>, <=, >=
  • Paranthesis: (, {, [
  • Functions in the form of: f(x,y,z,...)
  • List of predefined functions is avail - you install the source as the component
  • Figure: Drag Drop on your Delphi or C++ Builder Form as shown below:

    TbcParser math parser library is especially useful in scientific, engineering programs as well as financial spread sheet implementations.

    It’s internal arithmetic uses ‘Extended’ storage for floating point numbers.

    To be efficient in repeated calculations, parser creates a parse tree to represent the math formula and reuses this parse tree for each evaluation without the need to reparse.

    Optimizer: If Optimization is on, the parse tree will be optimized by calculating constant expression sections at once so that further evaluation requests will be quicker without the need to re-evaluate those sub trees.

    TbcParser comes with the Pascal source code and there is also a help file for reference and a demo application for aid in getting started. So it is easy to make it work with different versions of Delphi or C++ Builder in the future. You will be installing the bcParser.pas and not the dcu unit file. This makes it easy to upgrade to future Delphi versions without having to worry about getting new binaries from us.

  • Purchase and Download
  • Download evaluation version of TbcParser (Evaluation Limitations)
  • Delphi Example code
  • C++ Example code
  • Component Installation in Delphi 10.3.3 Rio [latest Delphi versions]
  • Component Installation in C++ Builder [old version]
  • Component Installation in Delphi [old version]
  • Math Parser Example for Delphi 2009 [old version - but usage is the same]
  • Download Windows Demo Application (EXE, 462KB)
  • Download Windows Demo Application in Zip compressed format (Zip, 238KB)
  • Math Parser for Delphi Help File (chm version, common problems with chm)
  • Math Parser for Delphi PDF Manual
  • Math Parser for Delphi Online Html Help - No Frames
  • Math Parser for Delphi Online Html Help - Frames
  • How To Install Math Parser Delphi Component

    The trial versions are installed as dcu or bpl files through Delphi’s Component menu. The release versions are best installed from the source code using bcParser.pas file. In earlier Delphi versions, you just pick bcParser.pas instead of the dcu. In newer Delphi versions, you need to create a package project. Then add bcParser.pas to this package project. Pick your build target to be 32 or 64 bit. Adjust your build settings if you like. Right click your package project to BUILD. Then right click and pick INSTALL. That’s all there is to it.

    Here are screen shots of install in Delphi 10.3.3, insall in Delphi 7, install in Delphi 2009 and install in C++ Builder.

    The Math Parser Component is also available on many platforms/languages such as:

    Examples of typical expressions are:

    SIN(3.14)+5^2+POW(2,MAX(X* 2,Y))

    Functions, variables, constants can be nested.
    Common math functions are defined by default.

    2*[LN(1+X) / LOG(1-X)]

    Paranthesis can be (, {, [ for readability.

    IF(X>0, 3/X, F(X))

    IF(a,b,c) branching function is supported.

    Boolean operators are supported. Any non-zero value is TRUE, 0 is FALSE.

    Functions can be defined to have 1,2,...N numbers of parameters.



    Constants supported. For example, PI is a constant, not a variable. When optimization is turned on, constants may improve the speed of repeated evaluations where expression does not change but variable values change.


    If Optimization is turned ON, LOG(1+5) will be optimized away since it is a constant.


    You can create your own functions and variables and name them as you wish.

    You can replace a predefined function with your own implementation.


    Scientific notation is supported: 3E-2

    You can download a trial version of TbcParser here [Zip file, 402KB]
    Zip file contains the compiled components for Delphi 5,6,7 and C++Builder 5,6. It also contains a demo application and the help file for the component.

    Download ready to run demo application [Exe File 462KB].

    View Delphi Example code.

    Demo Screen Shots:

    This demo application shows examples of the features of the math parser.

    • X and Y are predefined variables (You can undefine them if need be).
    • If the user do not enter valid numbers for X and Y in the GUI, and if the expression does not use them, this application dos not report error, because we can ask the component whether a variable is used and only after that we try to parse the user input.
    • You can enter a name in the Custom Variable edit box and Add your own variable with the specified Value. And then you can use this variable in the expression.
    • You can get a list of currently defined functions and variables as seen in the related combo boxes.
    • Various expression examples, simple and complex are given.
    • Scientific notation is supported (3E-3).
    • IF(condition, case1, case2) and logical operators such as >=, <> etc are supported.

    Below is an example of an error message where it pinpoints the invalid string. This information can be accessed using the EbcParserError.GetInvalidPortionOfExpression function. Most users use this facility to allow their users use any variable they want, and their application catches EbcParserError exception and defines the undefined variable on the fly and proceeds to parse the expression again. This makes it possible to write applications that does not know the variable names ahead of time.

    Error reporting

    As below example shows, a custom variable can be defined and used in the expression. (Custom functions can be defined too). After the variable CUSTOMVAR is created with value 3, the result of the expression is 7 :

    Custom variable defined

    Math Parser Trial Version Limitation

    bcParser math parser trial version ships as dcu files and bpl files for some Delphi versions. We wish could keep all of these binaries upto date with respect to the latest version, but every time we make a change, having to compile the component for each and every version of Delphi and packing it is a very very time consuming task for us. Therefore, the current trial version binaries (except Delphi 2010) are based on version 3.4 where as the latest release is version 3.5 and add OnVariableFound event handler. The release version always comes as bcParser.pas file which you can install into any Win32 Delphi or C++ Version you use. Trial version does not support Mac OSX or iOS development. Trial is for Windows only.

    Trial version runs while the IDE is running.

    Math Parser help file is available for separate download for quick review[45KB]Download  Math Parser Help File
    (common problems with chm files)

    Software License for your review.

    Purchasing TbcParser Math Parser Component

    You can pay with credit card and download TbcParser immediately from our online store for only $29.95. Full version includes Pascal source code. Upgrades are free for registered users.
    Licensing is per developer. You can deploy the the component royalty free with your applications as many times as you want. Site license allows any number of developers use the component at your development site. Site License is $290.95. Site licenses can be purchased here.

    TbcParser comes in two flavors: Version 3.8 for old Delphi versions, and a new upgraded TbcParser version 4.0 for the Delphi XE and iOS development. Version 3.8 also works with Lazarus / Free Pascal. When you buy it, you get both versions to use in any Delphi version you like.

    Online Order Form

    Sample Screen Shots

    Press Control Wizard is a hardware control application which allows motion profiles to be entered as a mathematical function. Such capability makes it possible to apply theoretical  calculations to reality easily. This application uses an earlier version of the component.


    Above Mechanical Engineering application is used to calculate Forging Loads given certain input. One of the inputs required is the Flow Stress of the material being forged and is typically parametric. Below figure shows how the TbcParser Component is used to let the user specify a custom flow stress formula:


    Above application was used to calculate tool wear in different machining processes. TbcParser is used to let the user specify material properties such as Flow Stress, Density, Specific Heat, and Thermal Conductivity as a function of temperature through the GUI or from a material database where functions (in string form) are pre-recorded for each material.

    Math Parser for Lazarus IDE

    If you like Free Pascal and Lazarus, then bcParser can still help you. Just set the {$mode delphi} at the top and bcParser.pas will compile and install into your Lazarus IDE without problem:


    Purchasing TbcParser Math Parser Component

    You can pay with credit card and download TbcParser immediately from our online store for only $29.95. Full version includes Pascal source code. Upgrades are free for registered users.
    Licensing is per developer. You can deploy the the component royalty free with your applications as many times as you want. Site license allows any number of developers use the component at your development site. Site License is $290.95. Site licenses can be purchased here.

    Online Order Form

    For technical questions please contact


    Math Parser Online Store