private static PrettyPrinter.Node ShowStackNode(ImmutableDictionary <int, TiNode> heap, TiNode node) =>
 node switch
 {
Example #2
0
        private static (ImmutableDictionary <int, TiNode>, int) Allocate(ImmutableDictionary <int, TiNode> heap, TiNode node)
        {
            var addr    = heap.Keys.Max() + 1;
            var newHeap = heap.Add(addr, node);

            return(newHeap, addr);
        }
Example #3
0
 private static (ImmutableDictionary <int, TiNode>, int) AssignOrAllocate(int?addr, ImmutableDictionary <int, TiNode> heap, TiNode node)
 {
     return(addr.HasValue ? (Assign(addr.Value, heap, node), addr.Value) : Allocate(heap, node));
 }
Example #4
0
 private static ImmutableDictionary <int, TiNode> Assign(int addr, ImmutableDictionary <int, TiNode> heap, TiNode node)
 {
     return(heap.SetItem(addr, node));
 }
 public Marked(TiNode node)
 {
     Node = node;
 }