uCalc API Version: 2.1.3-preview.2 Released: 6/16/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

Define

Method

Product: 

Fast Math Parser

Class: 

uCalcBase

Creates functions, operators, variables, and other symbols using a single, versatile definition string.

Syntax

Define(string, ADDR, DataType)

Parameters

definitionString
string
A string containing the definition command and syntax (e.g., "Function: f(x) = x+1").
targetAddress
ADDR
(Default = 0)
An optional memory address to bind a variable or function to an external value or callback.
targetType
DataType
(Default = Empty)
An optional data type to associate with the item, used when the type cannot be inferred from the definition string.

Return

Item

An Item object representing the newly created symbol.

Remarks

The Define method is the core, string-based engine for creating all uCalc symbols, such as functions, operators, variables, and data types. It parses a special definition string that specifies both the type of symbol to create and its properties.

While powerful, developers should generally prefer the specialized, type-safe methods like DefineFunction(), DefineOperator(), and DefineVariable(). Define is best suited for scenarios requiring dynamic symbol creation or for enabling end-users to define symbols within an evaluated expression (e.g., Eval("Define('Function: MyFunc(x)=x*2')")), or with the {@Define} Transformer pattern method.


⚙️ Definition Syntax

A definition string consists of a command keyword, a colon :, and the definition body. Some commands can be chained using ~~ as a separator.

Command Reference

CommandDescriptionExample
FunctionDefines a function."Function: f(x) = x + 5"
OperatorDefines an operator."Operator: {x} %% {y} = x * y"
VariableDefines a variable."Variable: MyVar = 1234"
DataTypeCreates a new data type."DataType: Int16 : Type_Integer_16"
TokenDefines a parser token using regex."Token: //.*"
TokenTypeSets the token type."TokenType: whitespace ~~ Token: //.*"
LockMakes a symbol read-only (a constant)."Lock ~~ Variable: pi = 3.14"
OverwriteReplaces a definition, updating all dependent expressions."Overwrite ~~ Function: f(x) = x + 1"
BootstrapRedefines a function using its previous definition."Bootstrap ~~ Function: Cos(x) = Cos(x*pi/180)"
PrecedenceSets an operator's precedence level."Precedence: 25 ~~ Operator: ..."
AssociativitySets operator associativity (LeftToRight or RightToLeft)."Associativity: RightToLeft ~~ Operator: ..."
FormatDefines output formatting for EvalStr()."Format: Result = 'Ans: ' + Result"
BooleanConfigures boolean values and string representations."Boolean: -1, Yes, No"
Converts...Defines type conversion rules (ConvertsBetween, ConvertsFrom, ConvertsTo)."ConvertsBetween: Int, Double"

Function and Operator Definitions

These follow the same syntax as their dedicated methods. For details, see DefineFunction() and DefineOperator().

  • Functions: Function: name(param As Type) As ReturnType = expression
  • Operators: Operator: {operand1} op_symbol {operand2} = expression

Shortcuts

Some commands have an alternative shortened keyword, such as Var for Variable, Func for Function, and Op for Operator. You can use RL in place of RightToLeft and LR in place of LeftToRight.

Associativity can be combined with precedence with by with the precedence numerical value followed by a : and followed by RL or LF (e.g., Operator: 15:RL {ByRef x As String} = {y As String} As String)

Property Modifiers (Lock, Overwrite, Bootstrap)

These commands precede another definition, separated by ~~, to alter its behavior.

  • uc.Define("Lock ~~ Variable: PI = 3.14159"); is equivalent to calling DefineConstant().
  • Overwrite is essential for spreadsheet-like applications where changing one cell's formula must automatically update all cells that depend on it.
  • Bootstrap allows you to wrap an existing function without causing infinite recursion. The function call on the right side of the = refers to the old implementation.

Token Definitions

Define can add or modify parser tokens recognized by Parse().

// Define C-style line comments as whitespaceuc.Define("TokenType: Whitespace ~~ Token: //.* ");// Now, expressions with comments will parse correctlyConsole.WriteLine(uc.Eval("10 + 5 // This is ignored"));

For more control, use ExpressionTokens().


Comparative Analysis: Define vs. Specialized Methods

Aspectuc.Define("Function: f(x)=x+1")uc.DefineFunction("f(x)=x+1")
Type Safety🔴 Low. Typos in "Function: ..." are runtime errors.🟢 High. The method call is checked by the compiler.
Clarity🟡 Medium. The intent is inside a string.🟢 High. The method name clearly states the intent.
Flexibility🟢 High. Can combine multiple commands in one string.🟡 Medium. Parameters control behavior, which is less compact but clearer.
Use CaseDynamic/scripted definitions, end-user input.Direct API usage by developers.

Conclusion: Always prefer the specialized methods (DefineFunction, DefineVariable, etc.) in your application code. Use Define only when you need to construct definitions dynamically at runtime.

Examples

A succinct example defining a simple variable and function.
				
					using uCalcSoftware;

var uc = new uCalc();
// Define a variable and a function using the core Define method
uc.Define("Variable: my_var = 100");
uc.Define("Function: square(x) = x * x");

Console.WriteLine(uc.Eval("my_var * square(5)"));
				
			
2500
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Define a variable and a function using the core Define method
   uc.Define("Variable: my_var = 100");
   uc.Define("Function: square(x) = x * x");

   cout << uc.Eval("my_var * square(5)") << endl;
}
				
			
2500
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Define a variable and a function using the core Define method
      uc.Define("Variable: my_var = 100")
      uc.Define("Function: square(x) = x * x")
      
      Console.WriteLine(uc.Eval("my_var * square(5)"))
   End Sub
End Module
				
			
2500
Internal Test: Verifying 'Overwrite' for interdependent definitions in a spreadsheet simulation.
				
					using uCalcSoftware;

var uc = new uCalc();
// Define interdependent 'cells' using the Overwrite command.
uc.Define("Overwrite ~~ Function: A1() = 10");
uc.Define("Overwrite ~~ Function: B1() = A1() * 2");
uc.Define("Overwrite ~~ Function: C1() = A1() + B1()");

Console.WriteLine($"Initial C1: {uc.Eval("C1()")}"); // Should be 10 + (10 * 2) = 30

// Now, overwrite the source cell A1. All dependent cells should automatically update.
uc.Define("Overwrite ~~ Function: A1() = 50");

Console.WriteLine($"Updated B1: {uc.Eval("B1()")}"); // Should now be 50 * 2 = 100
Console.WriteLine($"Updated C1: {uc.Eval("C1()")}"); // Should now be 50 + 100 = 150
				
			
Initial C1: 30
Updated B1: 100
Updated C1: 150
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Define interdependent 'cells' using the Overwrite command.
   uc.Define("Overwrite ~~ Function: A1() = 10");
   uc.Define("Overwrite ~~ Function: B1() = A1() * 2");
   uc.Define("Overwrite ~~ Function: C1() = A1() + B1()");

   cout << "Initial C1: " << uc.Eval("C1()") << endl; // Should be 10 + (10 * 2) = 30

   // Now, overwrite the source cell A1. All dependent cells should automatically update.
   uc.Define("Overwrite ~~ Function: A1() = 50");

   cout << "Updated B1: " << uc.Eval("B1()") << endl; // Should now be 50 * 2 = 100
   cout << "Updated C1: " << uc.Eval("C1()") << endl; // Should now be 50 + 100 = 150
}
				
			
Initial C1: 30
Updated B1: 100
Updated C1: 150
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Define interdependent 'cells' using the Overwrite command.
      uc.Define("Overwrite ~~ Function: A1() = 10")
      uc.Define("Overwrite ~~ Function: B1() = A1() * 2")
      uc.Define("Overwrite ~~ Function: C1() = A1() + B1()")
      
      Console.WriteLine($"Initial C1: {uc.Eval("C1()")}") '// Should be 10 + (10 * 2) = 30
      
      '// Now, overwrite the source cell A1. All dependent cells should automatically update.
      uc.Define("Overwrite ~~ Function: A1() = 50")
      
      Console.WriteLine($"Updated B1: {uc.Eval("B1()")}") '// Should now be 50 * 2 = 100
      Console.WriteLine($"Updated C1: {uc.Eval("C1()")}") '// Should now be 50 + 100 = 150
   End Sub
End Module
				
			
Initial C1: 30
Updated B1: 100
Updated C1: 150
How to define a constant, variable, operator, function, output format, and token with Define()
				
					using uCalcSoftware;

var uc = new uCalc();
Console.WriteLine("------ Basic examples -------");
uc.Define("Function: f(x, y) = x + y");
uc.Define("Operator: {x} %% {y} = x * y");
uc.Define("Variable: MyVar = 123");

Console.WriteLine(uc.Eval("f(5, 10)"));
Console.WriteLine(uc.Eval("5 %% 10"));
Console.WriteLine(uc.Eval("MyVar * 100"));

// End users can also call Define()
Console.WriteLine("------ End user definition -------");
uc.Eval("Define('Function: ff(x) = x * 1000')");
Console.WriteLine(uc.Eval("ff(987)"));

Console.WriteLine("------ Boolean format -------");
Console.WriteLine(uc.EvalStr("1 < 2"));
Console.WriteLine(uc.EvalStr("1 > 2"));
Console.WriteLine(uc.EvalStr("Int(1 < 2)"));
Console.WriteLine(uc.EvalStr("(True Or False) And (True And False)"));
uc.Define("Boolean: 55, TotallyTrue, CompletelyFalse");
Console.WriteLine(uc.EvalStr("1 < 2"));
Console.WriteLine(uc.EvalStr("1 > 2"));
Console.WriteLine(uc.EvalStr("Int(1 < 2)"));
Console.WriteLine(uc.EvalStr("(TotallyTrue Or CompletelyFalse) And (TotallyTrue And CompletelyFalse)"));

// Format - configures the formatting for the output given by EvalStr
Console.WriteLine("------ Format -------");
uc.Define("Format: Result = 'Answer: <' + Result + '>'");
uc.Define("Format: String, val = 'String Value --> ' + val");
Console.WriteLine(uc.EvalStr("1+2"));
Console.WriteLine(uc.EvalStr("'Hello ' + 'world!'"));
var Additional = uc.Define("Format: ret = 'Additional format: ' + ret");
Console.WriteLine(uc.EvalStr("1+2"));
uc.Define("Format: InsertAt: 0, result = 'The ' + result");
Console.WriteLine(uc.EvalStr("1+2"));
Additional.Release();
Console.WriteLine(uc.EvalStr("1+2"));
uc.FormatRemove();

// Bootstrap - builds new def on top of existing one
Console.WriteLine("------ Bootstrap -------");
Console.WriteLine(uc.EvalStr("Hex(123)")); // uses "built-in" version of Hex()
var MyHex = uc.Define("Bootstrap ~~ Function: Hex(number As Int) As String = '0x' + UCase(Hex(number))");
Console.WriteLine(uc.EvalStr("Hex(123)"));
MyHex.Release();
Console.WriteLine(uc.EvalStr("Hex(123)"));

// Overwrite - useful for spreadsheet-like functionality
Console.WriteLine("------ Overwrite -------");
uc.Define("Overwrite ~~ Func: SpreadsheetCell_A1() = 5");
uc.Define("Overwrite ~~ Func: SpreadsheetCell_B2() = SpreadsheetCell_A1() * 10");
uc.Define("Overwrite ~~ Func: SpreadsheetCell_C3() = SpreadsheetCell_A1() + SpreadsheetCell_B2()");
Console.WriteLine(uc.Eval("SpreadsheetCell_A1()"));
Console.WriteLine(uc.Eval("SpreadsheetCell_B2()"));
Console.WriteLine(uc.Eval("SpreadsheetCell_C3()"));
// SpreadsheetCell_C3() will be affected by the definition changes of SpreadsheetCell_A1() and  SpreadsheetCell_B3()
uc.Define("Overwrite ~~ Func: SpreadsheetCell_B2() = SpreadsheetCell_A1() * 100");
uc.Define("Overwrite ~~ Func: SpreadsheetCell_A1() = 25");
Console.WriteLine("-------");
// Note: Empty parenthesis are optional for functions with no parameters
Console.WriteLine(uc.Eval("SpreadsheetCell_A1"));
Console.WriteLine(uc.Eval("SpreadsheetCell_B2"));
Console.WriteLine(uc.Eval("SpreadsheetCell_C3"));

// Lock
Console.WriteLine("------ Lock -------");
uc.Define("Variable: xy = 555");
uc.Define("Lock ~~ Variable: pi = 3.14"); // like using DefineConstant()
Console.WriteLine(uc.EvalStr("xy"));
Console.WriteLine(uc.EvalStr("pi"));
Console.WriteLine(uc.EvalStr("xy = 222")); // This variable is being changed
Console.WriteLine(uc.EvalStr("pi = 3.14159")); // This one is locked and cannot be changed
Console.WriteLine(uc.EvalStr("xy")); // Returns the new value of xy
Console.WriteLine(uc.EvalStr("pi")); // pi did not change; returns original value
Console.WriteLine("-------");
uc.Define("Function: f1(x) = x + 100");
uc.Define("Lock ~~ Function: f2(x) = x + 200"); // End-user can't change f2
Console.WriteLine(uc.Eval("f1(5)"));
Console.WriteLine(uc.Eval("f2(5)"));
uc.Eval("Define('Function: f1(x) = x + 300')");
uc.Eval("Define('Function: f2(x) = x + 400')"); // This re-definition is ignored
Console.WriteLine(uc.Eval("f1(5)"));
Console.WriteLine(uc.Eval("f2(5)"));

// Tokens
Console.WriteLine("------ Tokens -------");
Console.WriteLine(uc.EvalStr("5 + 4 // This comment causes an error"));
Console.WriteLine(uc.EvalStr("5 + /* comment not recognized yet */ 10"));
uc.Define("TokenType: Whitespace ~~ Token: //.*"); // // C-style to end-of-line comment
uc.Define("TokenType: Whitespace ~~ Token: /[*].*?[*]/"); // /* C-style enclosed comment */
Console.WriteLine(uc.EvalStr("5 + 4 // This comment will be ignored"));
Console.WriteLine(uc.EvalStr("5 + /* comment ignored */ 10"));

// Precedence
Console.WriteLine("------ Precedence -------");
uc.Define("Precedence: 1    ~~ Operator: {a As Int32} OpA {b As Int32} = a + b");
uc.Define("Precedence: 1000 ~~ Operator: {a As Int32} OpB {b As Int32} = a + b");
Console.WriteLine(uc.Eval("5 OpA 4 * 10"));
Console.WriteLine(uc.Eval("5 OpB 4 * 10"));

// Associativity
Console.WriteLine("------ Associativity -------");
uc.Define("Associativity: LeftToRight ~~ Operator: {x} OpX {y} = x / y");
uc.Define("Associativity: RightToLeft ~~ Operator: {x} OpY {y} = x / y");
Console.WriteLine(uc.Eval("3 OpX 4 OpX 5"));
Console.WriteLine(uc.Eval("3 OpY 4 OpY 5"));
				
			
------ Basic examples -------
15
50
12300
------ End user definition -------
987000
------ Boolean format -------
true
false
1
false
TotallyTrue
CompletelyFalse
55
CompletelyFalse
------ Format -------
Answer: <3>
Answer: <String Value --> Hello world!>
Answer: <Additional format: 3>
The Answer: <Additional format: 3>
The Answer: <3>
------ Bootstrap -------
7b
0x7B
7b
------ Overwrite -------
5
50
55
-------
25
2500
2525
------ Lock -------
555
3.14
222
Value cannot be assigned here
222
3.14
-------
105
205
305
205
------ Tokens -------
Undefined identifier
Undefined identifier
9
15
------ Precedence -------
45
90
------ Associativity -------
0.15
3.75
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   cout << "------ Basic examples -------" << endl;
   uc.Define("Function: f(x, y) = x + y");
   uc.Define("Operator: {x} %% {y} = x * y");
   uc.Define("Variable: MyVar = 123");

   cout << uc.Eval("f(5, 10)") << endl;
   cout << uc.Eval("5 %% 10") << endl;
   cout << uc.Eval("MyVar * 100") << endl;

   // End users can also call Define()
   cout << "------ End user definition -------" << endl;
   uc.Eval("Define('Function: ff(x) = x * 1000')");
   cout << uc.Eval("ff(987)") << endl;

   cout << "------ Boolean format -------" << endl;
   cout << uc.EvalStr("1 < 2") << endl;
   cout << uc.EvalStr("1 > 2") << endl;
   cout << uc.EvalStr("Int(1 < 2)") << endl;
   cout << uc.EvalStr("(True Or False) And (True And False)") << endl;
   uc.Define("Boolean: 55, TotallyTrue, CompletelyFalse");
   cout << uc.EvalStr("1 < 2") << endl;
   cout << uc.EvalStr("1 > 2") << endl;
   cout << uc.EvalStr("Int(1 < 2)") << endl;
   cout << uc.EvalStr("(TotallyTrue Or CompletelyFalse) And (TotallyTrue And CompletelyFalse)") << endl;

   // Format - configures the formatting for the output given by EvalStr
   cout << "------ Format -------" << endl;
   uc.Define("Format: Result = 'Answer: <' + Result + '>'");
   uc.Define("Format: String, val = 'String Value --> ' + val");
   cout << uc.EvalStr("1+2") << endl;
   cout << uc.EvalStr("'Hello ' + 'world!'") << endl;
   auto Additional = uc.Define("Format: ret = 'Additional format: ' + ret");
   cout << uc.EvalStr("1+2") << endl;
   uc.Define("Format: InsertAt: 0, result = 'The ' + result");
   cout << uc.EvalStr("1+2") << endl;
   Additional.Release();
   cout << uc.EvalStr("1+2") << endl;
   uc.FormatRemove();

   // Bootstrap - builds new def on top of existing one
   cout << "------ Bootstrap -------" << endl;
   cout << uc.EvalStr("Hex(123)") << endl; // uses "built-in" version of Hex()
   auto MyHex = uc.Define("Bootstrap ~~ Function: Hex(number As Int) As String = '0x' + UCase(Hex(number))");
   cout << uc.EvalStr("Hex(123)") << endl;
   MyHex.Release();
   cout << uc.EvalStr("Hex(123)") << endl;

   // Overwrite - useful for spreadsheet-like functionality
   cout << "------ Overwrite -------" << endl;
   uc.Define("Overwrite ~~ Func: SpreadsheetCell_A1() = 5");
   uc.Define("Overwrite ~~ Func: SpreadsheetCell_B2() = SpreadsheetCell_A1() * 10");
   uc.Define("Overwrite ~~ Func: SpreadsheetCell_C3() = SpreadsheetCell_A1() + SpreadsheetCell_B2()");
   cout << uc.Eval("SpreadsheetCell_A1()") << endl;
   cout << uc.Eval("SpreadsheetCell_B2()") << endl;
   cout << uc.Eval("SpreadsheetCell_C3()") << endl;
   // SpreadsheetCell_C3() will be affected by the definition changes of SpreadsheetCell_A1() and  SpreadsheetCell_B3()
   uc.Define("Overwrite ~~ Func: SpreadsheetCell_B2() = SpreadsheetCell_A1() * 100");
   uc.Define("Overwrite ~~ Func: SpreadsheetCell_A1() = 25");
   cout << "-------" << endl;
   // Note: Empty parenthesis are optional for functions with no parameters
   cout << uc.Eval("SpreadsheetCell_A1") << endl;
   cout << uc.Eval("SpreadsheetCell_B2") << endl;
   cout << uc.Eval("SpreadsheetCell_C3") << endl;

   // Lock
   cout << "------ Lock -------" << endl;
   uc.Define("Variable: xy = 555");
   uc.Define("Lock ~~ Variable: pi = 3.14"); // like using DefineConstant()
   cout << uc.EvalStr("xy") << endl;
   cout << uc.EvalStr("pi") << endl;
   cout << uc.EvalStr("xy = 222") << endl; // This variable is being changed
   cout << uc.EvalStr("pi = 3.14159") << endl; // This one is locked and cannot be changed
   cout << uc.EvalStr("xy") << endl; // Returns the new value of xy
   cout << uc.EvalStr("pi") << endl; // pi did not change; returns original value
   cout << "-------" << endl;
   uc.Define("Function: f1(x) = x + 100");
   uc.Define("Lock ~~ Function: f2(x) = x + 200"); // End-user can't change f2
   cout << uc.Eval("f1(5)") << endl;
   cout << uc.Eval("f2(5)") << endl;
   uc.Eval("Define('Function: f1(x) = x + 300')");
   uc.Eval("Define('Function: f2(x) = x + 400')"); // This re-definition is ignored
   cout << uc.Eval("f1(5)") << endl;
   cout << uc.Eval("f2(5)") << endl;

   // Tokens
   cout << "------ Tokens -------" << endl;
   cout << uc.EvalStr("5 + 4 // This comment causes an error") << endl;
   cout << uc.EvalStr("5 + /* comment not recognized yet */ 10") << endl;
   uc.Define("TokenType: Whitespace ~~ Token: //.*"); // // C-style to end-of-line comment
   uc.Define("TokenType: Whitespace ~~ Token: /[*].*?[*]/"); // /* C-style enclosed comment */
   cout << uc.EvalStr("5 + 4 // This comment will be ignored") << endl;
   cout << uc.EvalStr("5 + /* comment ignored */ 10") << endl;

   // Precedence
   cout << "------ Precedence -------" << endl;
   uc.Define("Precedence: 1    ~~ Operator: {a As Int32} OpA {b As Int32} = a + b");
   uc.Define("Precedence: 1000 ~~ Operator: {a As Int32} OpB {b As Int32} = a + b");
   cout << uc.Eval("5 OpA 4 * 10") << endl;
   cout << uc.Eval("5 OpB 4 * 10") << endl;

   // Associativity
   cout << "------ Associativity -------" << endl;
   uc.Define("Associativity: LeftToRight ~~ Operator: {x} OpX {y} = x / y");
   uc.Define("Associativity: RightToLeft ~~ Operator: {x} OpY {y} = x / y");
   cout << uc.Eval("3 OpX 4 OpX 5") << endl;
   cout << uc.Eval("3 OpY 4 OpY 5") << endl;
}
				
			
------ Basic examples -------
15
50
12300
------ End user definition -------
987000
------ Boolean format -------
true
false
1
false
TotallyTrue
CompletelyFalse
55
CompletelyFalse
------ Format -------
Answer: <3>
Answer: <String Value --> Hello world!>
Answer: <Additional format: 3>
The Answer: <Additional format: 3>
The Answer: <3>
------ Bootstrap -------
7b
0x7B
7b
------ Overwrite -------
5
50
55
-------
25
2500
2525
------ Lock -------
555
3.14
222
Value cannot be assigned here
222
3.14
-------
105
205
305
205
------ Tokens -------
Undefined identifier
Undefined identifier
9
15
------ Precedence -------
45
90
------ Associativity -------
0.15
3.75
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Console.WriteLine("------ Basic examples -------")
      uc.Define("Function: f(x, y) = x + y")
      uc.Define("Operator: {x} %% {y} = x * y")
      uc.Define("Variable: MyVar = 123")
      
      Console.WriteLine(uc.Eval("f(5, 10)"))
      Console.WriteLine(uc.Eval("5 %% 10"))
      Console.WriteLine(uc.Eval("MyVar * 100"))
      
      '// End users can also call Define()
      Console.WriteLine("------ End user definition -------")
      uc.Eval("Define('Function: ff(x) = x * 1000')")
      Console.WriteLine(uc.Eval("ff(987)"))
      
      Console.WriteLine("------ Boolean format -------")
      Console.WriteLine(uc.EvalStr("1 < 2"))
      Console.WriteLine(uc.EvalStr("1 > 2"))
      Console.WriteLine(uc.EvalStr("Int(1 < 2)"))
      Console.WriteLine(uc.EvalStr("(True Or False) And (True And False)"))
      uc.Define("Boolean: 55, TotallyTrue, CompletelyFalse")
      Console.WriteLine(uc.EvalStr("1 < 2"))
      Console.WriteLine(uc.EvalStr("1 > 2"))
      Console.WriteLine(uc.EvalStr("Int(1 < 2)"))
      Console.WriteLine(uc.EvalStr("(TotallyTrue Or CompletelyFalse) And (TotallyTrue And CompletelyFalse)"))
      
      '// Format - configures the formatting for the output given by EvalStr
      Console.WriteLine("------ Format -------")
      uc.Define("Format: Result = 'Answer: <' + Result + '>'")
      uc.Define("Format: String, val = 'String Value --> ' + val")
      Console.WriteLine(uc.EvalStr("1+2"))
      Console.WriteLine(uc.EvalStr("'Hello ' + 'world!'"))
      Dim Additional = uc.Define("Format: ret = 'Additional format: ' + ret")
      Console.WriteLine(uc.EvalStr("1+2"))
      uc.Define("Format: InsertAt: 0, result = 'The ' + result")
      Console.WriteLine(uc.EvalStr("1+2"))
      Additional.Release()
      Console.WriteLine(uc.EvalStr("1+2"))
      uc.FormatRemove()
      
      '// Bootstrap - builds new def on top of existing one
      Console.WriteLine("------ Bootstrap -------")
      Console.WriteLine(uc.EvalStr("Hex(123)")) '// uses "built-in" version of Hex()
      Dim MyHex = uc.Define("Bootstrap ~~ Function: Hex(number As Int) As String = '0x' + UCase(Hex(number))")
      Console.WriteLine(uc.EvalStr("Hex(123)"))
      MyHex.Release()
      Console.WriteLine(uc.EvalStr("Hex(123)"))
      
      '// Overwrite - useful for spreadsheet-like functionality
      Console.WriteLine("------ Overwrite -------")
      uc.Define("Overwrite ~~ Func: SpreadsheetCell_A1() = 5")
      uc.Define("Overwrite ~~ Func: SpreadsheetCell_B2() = SpreadsheetCell_A1() * 10")
      uc.Define("Overwrite ~~ Func: SpreadsheetCell_C3() = SpreadsheetCell_A1() + SpreadsheetCell_B2()")
      Console.WriteLine(uc.Eval("SpreadsheetCell_A1()"))
      Console.WriteLine(uc.Eval("SpreadsheetCell_B2()"))
      Console.WriteLine(uc.Eval("SpreadsheetCell_C3()"))
      '// SpreadsheetCell_C3() will be affected by the definition changes of SpreadsheetCell_A1() and  SpreadsheetCell_B3()
      uc.Define("Overwrite ~~ Func: SpreadsheetCell_B2() = SpreadsheetCell_A1() * 100")
      uc.Define("Overwrite ~~ Func: SpreadsheetCell_A1() = 25")
      Console.WriteLine("-------")
      '// Note: Empty parenthesis are optional for functions with no parameters
      Console.WriteLine(uc.Eval("SpreadsheetCell_A1"))
      Console.WriteLine(uc.Eval("SpreadsheetCell_B2"))
      Console.WriteLine(uc.Eval("SpreadsheetCell_C3"))
      
      '// Lock
      Console.WriteLine("------ Lock -------")
      uc.Define("Variable: xy = 555")
      uc.Define("Lock ~~ Variable: pi = 3.14") '// like using DefineConstant()
      Console.WriteLine(uc.EvalStr("xy"))
      Console.WriteLine(uc.EvalStr("pi"))
      Console.WriteLine(uc.EvalStr("xy = 222")) '// This variable is being changed
      Console.WriteLine(uc.EvalStr("pi = 3.14159")) '// This one is locked and cannot be changed
      Console.WriteLine(uc.EvalStr("xy")) '// Returns the new value of xy
      Console.WriteLine(uc.EvalStr("pi")) '// pi did not change; returns original value
      Console.WriteLine("-------")
      uc.Define("Function: f1(x) = x + 100")
      uc.Define("Lock ~~ Function: f2(x) = x + 200") '// End-user can't change f2
      Console.WriteLine(uc.Eval("f1(5)"))
      Console.WriteLine(uc.Eval("f2(5)"))
      uc.Eval("Define('Function: f1(x) = x + 300')")
      uc.Eval("Define('Function: f2(x) = x + 400')") '// This re-definition is ignored
      Console.WriteLine(uc.Eval("f1(5)"))
      Console.WriteLine(uc.Eval("f2(5)"))
      
      '// Tokens
      Console.WriteLine("------ Tokens -------")
      Console.WriteLine(uc.EvalStr("5 + 4 // This comment causes an error"))
      Console.WriteLine(uc.EvalStr("5 + /* comment not recognized yet */ 10"))
      uc.Define("TokenType: Whitespace ~~ Token: //.*") '// // C-style to end-of-line comment 
      uc.Define("TokenType: Whitespace ~~ Token: /[*].*?[*]/") '// /* C-style enclosed comment */
      Console.WriteLine(uc.EvalStr("5 + 4 // This comment will be ignored"))
      Console.WriteLine(uc.EvalStr("5 + /* comment ignored */ 10"))
      
      '// Precedence
      Console.WriteLine("------ Precedence -------")
      uc.Define("Precedence: 1    ~~ Operator: {a As Int32} OpA {b As Int32} = a + b")
      uc.Define("Precedence: 1000 ~~ Operator: {a As Int32} OpB {b As Int32} = a + b")
      Console.WriteLine(uc.Eval("5 OpA 4 * 10"))
      Console.WriteLine(uc.Eval("5 OpB 4 * 10"))
      
      '// Associativity
      Console.WriteLine("------ Associativity -------")
      uc.Define("Associativity: LeftToRight ~~ Operator: {x} OpX {y} = x / y")
      uc.Define("Associativity: RightToLeft ~~ Operator: {x} OpY {y} = x / y")
      Console.WriteLine(uc.Eval("3 OpX 4 OpX 5"))
      Console.WriteLine(uc.Eval("3 OpY 4 OpY 5"))
   End Sub
End Module
				
			
------ Basic examples -------
15
50
12300
------ End user definition -------
987000
------ Boolean format -------
true
false
1
false
TotallyTrue
CompletelyFalse
55
CompletelyFalse
------ Format -------
Answer: <3>
Answer: <String Value --> Hello world!>
Answer: <Additional format: 3>
The Answer: <Additional format: 3>
The Answer: <3>
------ Bootstrap -------
7b
0x7B
7b
------ Overwrite -------
5
50
55
-------
25
2500
2525
------ Lock -------
555
3.14
222
Value cannot be assigned here
222
3.14
-------
105
205
305
205
------ Tokens -------
Undefined identifier
Undefined identifier
9
15
------ Precedence -------
45
90
------ Associativity -------
0.15
3.75