uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Description: A non-functional structural directive used to include notes, explanations, or labels within a transformation pattern without affecting the match or the output.
The {@Comment} directive is the annotation tool of the uCalc::Transformer. It allows developers to document complex pattern logic directly within the pattern string itself.
When the uCalc engine parses a pattern containing {@Comment}, it effectively "strips" the comment directive. It does not look for a match for the comment content, nor does it insert the comment into the replacement result.
{@Comment: This matches a name}{@Alpha:name} is treated exactly like {@Alpha:name}.Hello{@Comment: friendly greeting} {name} is treated exactly like Hello {name}.In large-scale transformation projects where patterns can become quite dense, {@Comment} provides a way to:
Adding a note to a pattern that identifies a specific keyword.
New(uCalc::Transformer, t)// The comment is ignored by the enginet.FromTo("{@Comment: match the keyword} KEY", "FOUND")wl(t.Transform("KEY"))[Expected Output]FOUND
Using comments to clarify a multi-part transpiler rule that converts assignment syntax.
New(uCalc::Transformer, t)t.FromTo( "let {@Comment: identifier} {@Alpha:id} = {@Comment: value} {@Number:val}", "set {id} = {val}")var(string, input) = "let x = 10"wl(t.Transform(input))[Expected Output]set x = 10
Verifying that {@Comment} can be placed anywhere, even in the replacement string, without altering the result.
New(uCalc::Transformer, t)t.FromTo("{@Alpha:a}", "Word:{@Comment: add label} {a}")wl(t.Transform("Hello"))[Expected Output]Word: Hello
{@Comment} is that the explanation lives inside the code it describes. This prevents documentation from becoming stale or "drifting" away from the actual logic.{@Comment} primarily for non-obvious logic or structural anchors.@@ prefix is irrelevant for {@Comment} because there is no execution or evaluation logic to shift from rule-creation to match-time.ID: 205
using uCalcSoftware;
var uc = new uCalc();
var t = uc.NewTransformer();
t.FromTo("a {@Comment: Ignore this} b c", "x{@Comment: ignore} y z");
Console.WriteLine(t.Transform("a b. a b c. abc."));
a b. x y z. abc. using uCalcSoftware; var uc = new uCalc(); var t = uc.NewTransformer(); t.FromTo("a {@Comment: Ignore this} b c", "x{@Comment: ignore} y z"); Console.WriteLine(t.Transform("a b. a b c. abc."));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto t = uc.NewTransformer();
t.FromTo("a {@Comment: Ignore this} b c", "x{@Comment: ignore} y z");
cout << t.Transform("a b. a b c. abc.") << endl;
}
a b. x y z. abc. #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.FromTo("a {@Comment: Ignore this} b c", "x{@Comment: ignore} y z"); cout << t.Transform("a b. a b c. abc.") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim t = uc.NewTransformer()
t.FromTo("a {@Comment: Ignore this} b c", "x{@Comment: ignore} y z")
Console.WriteLine(t.Transform("a b. a b c. abc."))
End Sub
End Module
a b. x y z. abc. Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.NewTransformer() t.FromTo("a {@Comment: Ignore this} b c", "x{@Comment: ignore} y z") Console.WriteLine(t.Transform("a b. a b c. abc.")) End Sub End Module