uCalc Fast Math Parser &
Token-Aware Text Transformer

Welcome to the uCalc SDK, a comprehensive parsing and transformation SDK designed for modern, cross-platform development. Whether you need a lightning-fast math parser or a token-aware text engine, this C++ and .NET parsing SDK gives you the robust tools required to evaluate complex expressions, build domain-specific languages, and safely refactor structural data with ease.

Fast Math Parser

A high-performance, cross-platform engine to easily parse and evaluate complex mathematical expressions rapidly.

Text Transformer

Go beyond regex. Transform code and text using advanced yet intuitive, token-aware structural parsing and syntax manipulation.

Advanced String Library

A comprehensive string manipulation library for smart text processing operations.

A quick start example showing defining a variable, a function, and evaluating an expression.

ID: 1296

				
					using uCalcSoftware;

var uc = new uCalc();
uc.DefineVariable("x = 10");
uc.DefineFunction("DoubleThis(n) = n * 2");

Console.WriteLine(uc.Eval("DoubleThis(x) + 5"));
				
			
25
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   uc.DefineVariable("x = 10");
   uc.DefineFunction("DoubleThis(n) = n * 2");

   cout << uc.Eval("DoubleThis(x) + 5") << endl;
}
				
			
25
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      uc.DefineVariable("x = 10")
      uc.DefineFunction("DoubleThis(n) = n * 2")
      
      Console.WriteLine(uc.Eval("DoubleThis(x) + 5"))
   End Sub
End Module
				
			
25

Evaluate pre-parsed expressions rapidly

Achieve rapid execution speeds. uCalc separates the heavy lifting of parsing from the execution with its "Parse-Once, Evaluate-Many" architecture, making it blazing fast inside tight loops.

Benchmarking Tip: Clicking "Run" in this online example includes the overhead of network routing and remote compilation. To see the actual evaluation speed (which is near-instantaneous regardless of loop size), uncomment the StopWatch line to print the exact execution time of the loop itself, excluding online overhead.

Note: If you think the preview version is fast, wait until the optimized production release comes out.

Using the parse-evaluate pattern for high-performance calculations in a loop with a changing variable w/ stopwatch.

ID: 1460

				
					using uCalcSoftware;

var uc = new uCalc();
var variableX = uc.DefineVariable("x");
var userExpression = "x * 2 + 5";
var Total = 0.0;
var UpperBound = 1000000; // One million

// Parse the expression just once before the loop begins.
var parsedExpr = uc.Parse(userExpression);

var stopwatch = System.Diagnostics.Stopwatch.StartNew();
for (double x = 1; x <= UpperBound; x++) {
   variableX.Value(x);
   Total = Total + parsedExpr.Evaluate();
}
stopwatch.Stop();
//Uncomment the following line to reveal the actual speed:
//Console.WriteLine($"Elapsed Milliseconds: {stopwatch.ElapsedMilliseconds} ms");

Console.Write("Sum(1, "); Console.Write(UpperBound); Console.Write(", "); Console.Write(userExpression); Console.Write(") = "); Console.Write(Total);
				
			
Sum(1, 1000000, x * 2 + 5) = 1000006000000
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   auto variableX = uc.DefineVariable("x");
   auto userExpression = "x * 2 + 5";
   auto Total = 0.0;
   auto UpperBound = 1000000; // One million

   // Parse the expression just once before the loop begins.
   auto parsedExpr = uc.Parse(userExpression);


   for (double x = 1; x <= UpperBound; x++) {
      variableX.Value(x);
      Total = Total + parsedExpr.Evaluate();
   }

   cout << "Sum(1, " << UpperBound << ", " << userExpression << ") = " << (long long)Total;
}
				
			
Sum(1, 1000000, x * 2 + 5) = 1000006000000
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim variableX = uc.DefineVariable("x")
      Dim userExpression = "x * 2 + 5"
      Dim Total = 0.0
      Dim UpperBound = 1000000 '// One million
      
      '// Parse the expression just once before the loop begins.
      Dim parsedExpr = uc.Parse(userExpression)
      
      Dim stopwatch = System.Diagnostics.Stopwatch.StartNew()
      For x  As Double = 1 To UpperBound
         variableX.Value(x)
         Total = Total + parsedExpr.Evaluate()
      Next
      stopwatch.Stop()
      '//Uncomment the following line to reveal the actual speed:
      '//Console.WriteLine($"Elapsed Milliseconds: {stopwatch.ElapsedMilliseconds} ms");
      
      Console.Write("Sum(1, ")
      Console.Write(UpperBound)
      Console.Write(", ")
      Console.Write(userExpression)
      Console.Write(") = ")
      Console.Write(Total)
   End Sub
End Module
				
			
Sum(1, 1000000, x * 2 + 5) = 1000006000000
A single-pass transformer that converts headers, list items, bold, and italic Markdown syntax to HTML.

ID: 1404

				
					using uCalcSoftware;

var uc = new uCalc();
using (var t = new uCalc.Transformer()) {
   t.DefaultRuleSet.RewindOnChange = true;

   // 2. Define Rules (General rules first, specific rules last for LIFO precedence)

   // -- Inline rules --
   // Italic is defined before Bold, giving Bold higher precedence.
   t.FromTo("*{text}*", "<i>{text}</i>");
   t.FromTo("**{text}**", "<b>{text}</b>");

   // -- Block-level rules --
   t.FromTo("#{@Whitespace}{line}", "<h1>{line}</h1>");
   t.FromTo("*{@Whitespace}{line}", "<li>{line}</li>");
   t.FromTo("</li>{@nl}{@nl}", "</li>{@nl}</ul>{@nl}"); // {@nl} = NewLine
   t.FromTo("{@nl}{@nl}*{@Whitespace}", "{@nl}<ul>{@nl}* ");

   // 3. Define the input Markdown text
   var markdown = """

# Main Header

* First list item
* Second list item with **bold** text.
* Third list item with *italic* text.

Another paragraph with **bold** and *italic*.

""";

   // 4. Run the transformation and print the result
   Console.WriteLine(t.Transform(markdown));
}
				
			
<h1>Main Header</h1>
<ul>
<li>First list item</li>
<li>Second list item with <b>bold</b> text.</li>
<li>Third list item with <i>italic</i> text.</li>
</ul>
Another paragraph with <b>bold</b> and <i>italic</i>.
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   {
      uCalc::Transformer t;
      t.Owned(); // Causes t to be released when it goes out of scope
      t.DefaultRuleSet().RewindOnChange(true);

      // 2. Define Rules (General rules first, specific rules last for LIFO precedence)

      // -- Inline rules --
      // Italic is defined before Bold, giving Bold higher precedence.
      t.FromTo("*{text}*", "<i>{text}</i>");
      t.FromTo("**{text}**", "<b>{text}</b>");

      // -- Block-level rules --
      t.FromTo("#{@Whitespace}{line}", "<h1>{line}</h1>");
      t.FromTo("*{@Whitespace}{line}", "<li>{line}</li>");
      t.FromTo("</li>{@nl}{@nl}", "</li>{@nl}</ul>{@nl}"); // {@nl} = NewLine
      t.FromTo("{@nl}{@nl}*{@Whitespace}", "{@nl}<ul>{@nl}* ");

      // 3. Define the input Markdown text
      auto markdown = R"(
# Main Header

* First list item
* Second list item with **bold** text.
* Third list item with *italic* text.

Another paragraph with **bold** and *italic*.
)";

      // 4. Run the transformation and print the result
      cout << t.Transform(markdown) << endl;
   }
}
				
			
<h1>Main Header</h1>
<ul>
<li>First list item</li>
<li>Second list item with <b>bold</b> text.</li>
<li>Third list item with <i>italic</i> text.</li>
</ul>
Another paragraph with <b>bold</b> and <i>italic</i>.
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Using t As New uCalc.Transformer()
         t.DefaultRuleSet.RewindOnChange = true
         
         '// 2. Define Rules (General rules first, specific rules last for LIFO precedence)
         
         '// -- Inline rules --
         '// Italic is defined before Bold, giving Bold higher precedence.
         t.FromTo("*{text}*", "<i>{text}</i>")
         t.FromTo("**{text}**", "<b>{text}</b>")
         
         '// -- Block-level rules --
         t.FromTo("#{@Whitespace}{line}", "<h1>{line}</h1>")
         t.FromTo("*{@Whitespace}{line}", "<li>{line}</li>")
         t.FromTo("</li>{@nl}{@nl}", "</li>{@nl}</ul>{@nl}") '// {@nl} = NewLine
         t.FromTo("{@nl}{@nl}*{@Whitespace}", "{@nl}<ul>{@nl}* ")
         
         '// 3. Define the input Markdown text
         Dim markdown = "
# Main Header

* First list item
* Second list item with **bold** text.
* Third list item with *italic* text.

Another paragraph with **bold** and *italic*.
"
         
         '// 4. Run the transformation and print the result
         Console.WriteLine(t.Transform(markdown))
      End Using
   End Sub
End Module
				
			
<h1>Main Header</h1>
<ul>
<li>First list item</li>
<li>Second list item with <b>bold</b> text.</li>
<li>Third list item with <i>italic</i> text.</li>
</ul>
Another paragraph with <b>bold</b> and <i>italic</i>.

Parse text the intuitive way

Ditch complicated character-based RegEx patterns and use uCalc's smart approach to transforming text with token-aware parsing that understands the structure of your text.

Dive deeper by clicking one of the following step-by-step guides to building a real-world project.

Project: Building a Markdown to HTML Converter

Build a simple Markdown-to-HTML converter using the declarative rules of the uCalc Transformer.

Project: Building a JSON Formatter and Minifier

Build a simple parser for INI-style configuration files using the uCalc Transformer's hierarchical parsing capabilities.

Project: Creating a Simple DSL for Financial Transactions

Build a simple, readable Domain-Specific Language (DSL) for processing financial transactions using the ExpressionTransformer.

Project: A Unit Conversion DSL

Build a simple, readable Domain-Specific Language (DSL) for unit conversions using the ExpressionTransformer.

Project: Implementing a Custom Syntax Highlighter

Build a static analysis tool (linter) to enforce coding standards on a custom scripting language using the uCalc Transformer.

Project: Extracting and Aggregating Metrics from Server Logs

Build a server log parser that extracts and aggregates key performance metrics using the uCalc Transformer.

Tools Built with the uCalc Parsing and Transformation SDK

uCalc parsing and transformation SDK desktop application

Transformer Desktop App

A standalone tool for heavy-duty text and code transformation using intuitive patterns.

uCalc Console Calculator screenshot

Console Calculator

A lightweight command-line calculator. Perfect for power users.

uCalc Visual Studio Extension screenshot

Visual Studio Extension

Integrate the token-aware search and transformer tool directly into your IDE.