Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim uc1 As New uCalc()
      uc1.DefineVariable("val = 100")
      
      Dim uc2 As New uCalc()
      uc2.DefineVariable("val = 200")
      
      '// Create the transformer in uc1's context
      Dim t = uc1.NewTransformer()
      t.Text = "data"
      t.Pattern("data")
      t.Find()
      
      Dim m = t.Matches
      Dim parent_uc = m.uCalc
      
      Console.WriteLine($"Parent has value: {parent_uc.Eval("val")}")
      Console.WriteLine($"Is parent uc1? {parent_uc.MemoryIndex = uc1.MemoryIndex}")
      Console.WriteLine($"Is parent uc2? {parent_uc.MemoryIndex = uc2.MemoryIndex}")
   End Sub
End Module