Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim t = uc.ExpressionTransformer '// Base case: a single argument t.FromTo("AddUp({x})", "{x}") '// Recursive case: multiple arguments '// RewindOnChange(true) causes the transformer to re-scan the string after a replacement. '// This allows AddUp(1,2,3) -> (1 + AddUp(2,3)) -> (1 + (2 + AddUp(3))) -> (1 + (2 + 3)) t.FromTo("AddUp({x}, {y})", "({x} + AddUp({y}))").RewindOnChange = true Console.WriteLine("Input: AddUp(1, 2, 3, 4)") Console.WriteLine($"Result: {uc.Eval("AddUp(1, 2, 3, 4)")}") End Sub End Module