Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      Dim root_uc As New uCalc()
      root_uc.Description = "Root uCalc Instance"
      
      Dim main_t As New uCalc.Transformer(root_uc)
      
      '// Create a rule in the main transformer
      Dim outerRule = main_t.Pattern("OUTER({body})")
      
      '// Get a local transformer for the outer rule
      Dim local_t = outerRule.LocalTransformer
      local_t.Description = "Local Transformer"
      
      '// Create an inner rule inside the local transformer
      Dim innerRule = local_t.FromTo("INNER", "inner_match")
      
      '// Verify both rules resolve to the same root uCalc instance
      Dim outerParent = outerRule.uCalc
      Dim innerParent = innerRule.uCalc
      
      Console.WriteLine($"Outer rule's parent: {outerParent.Description}")
      Console.WriteLine($"Inner rule's parent: {innerParent.Description}")
      Console.WriteLine($"Both rules share the same root uCalc instance: {outerParent.Handle() = innerParent.Handle()}")
   End Sub
End Module