Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// The transformer 't' belongs to the main 'uc' instance.
      Dim t As New uCalc.Transformer(uc)
      
      '// Define a variable in the transformer's parent context.
      t.uCalc.DefineVariable("VarX = 123")
      
      '// This rule is created within 't' and will need to access VarX.
      Dim myRule = t.FromTo("x", "{@Eval: VarX}")
      
      '// Get the rule's parent uCalc instance...
      Dim parent_uc = myRule.uCalc
      
      '// ...and use it to evaluate an expression to prove we have the right context.
      Console.WriteLine($"Value of VarX in parent context: {parent_uc.Eval("VarX")}")
      
      '// Now, run the transformation. The {@Eval} in the rule
      '// correctly finds 'VarX' in its parent uCalc context.
      Console.WriteLine(t.Transform("The value is: x"))
   End Sub
End Module