The Fast Math Parser and Structural Text Transformer
Drop a powerful evaluation engine directly into your .NET and C++ applications. Parse math instantly and execute simple or complex find-and-replace rules.
A quick start example showing defining symbols and evaluating an expression.
using uCalcSoftware;
var uc = new uCalc();
uc.DefineVariable("x = 10");
uc.DefineFunction("DoubleThis(n) = n * 2");
Console.WriteLine(uc.Eval("DoubleThis(x) + 5"));
25 using uCalcSoftware; var uc = new uCalc(); uc.DefineVariable("x = 10"); uc.DefineFunction("DoubleThis(n) = n * 2"); Console.WriteLine(uc.Eval("DoubleThis(x) + 5"));
#include
#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 #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; }
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 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
Fast Math Parser
A high-performance, cross-platform engine for parsing and evaluating complex mathematical expressions rapidly.
Text Transformer
Go beyond regex. Transform code and text using advanced, token-aware structural parsing and syntax manipulation.
Advanced String Library
A comprehensive suite of string manipulation tools natively integrated to support heavy-duty text processing operations.
Very fast math evaluations
uCalc abstracts away the complexity of syntax trees. Update variables and re-evaluate expressions nearly instantly without recompiling the entire tree. Write less boilerplate and achieve rapid speeds.
⚡ Benchmarking Tip: Clicking "Run" includes the overhead of network routing and remote compilation. To see the actual evaluation speed (which is near-instant regardless of loop size), uncomment the StopWatch line to print the exact execution time of the loop itself.
Using the parse-evaluate pattern for high-performance calculations in a loop with a changing variable.
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 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);
#include
#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 #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; }
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 )
For x As Double = 1 To UpperBound
variableX.Value(x)
Total = Total + parsedExpr.Evaluate()
Next
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 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 ) For x As Double = 1 To UpperBound variableX.Value(x) Total = Total + parsedExpr.Evaluate() Next Console.Write("Sum(1, ") Console.Write(UpperBound) Console.Write(", ") Console.Write(userExpression) Console.Write(") = ") Console.Write(Total) End Sub End Module
A complete, single-pass transformer that converts headers, list items, bold, and italic Markdown syntax to HTML.
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}*", "{text}");
t.FromTo("**{text}**", "{text}");
// -- Block-level rules --
t.FromTo("#{@Whitespace}{line}", "{line}
");
t.FromTo("*{@Whitespace}{line}", " {line} ");
// 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>
<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>
Another paragraph with <b>bold</b> and <i>italic</i>. 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>"); // 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)); }
#include
#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}*", "{text}");
t.FromTo("**{text}**", "{text}");
// -- Block-level rules --
t.FromTo("#{@Whitespace}{line}", "{line}
");
t.FromTo("*{@Whitespace}{line}", "{line} ");
// 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>
<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>
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>"); // 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; } }
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}*", "{text}")
t.FromTo("**{text}**", "{text}")
'// -- Block-level rules --
t.FromTo("#{@Whitespace}{line}", "{line}
")
t.FromTo("*{@Whitespace}{line}", " {line} ")
'// 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>
<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>
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>") '// 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
Advanced text parsing
uCalc turns intricate parsing into child's play by letting you define patterns intuitively, instead of with complicated and brittle regex.
Tools Built with uCalc

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