Exemple #1
0
 public override void GenerateDependencyGraph(DependencyTracker tracker)
 {
     base.GenerateDependencyGraph(tracker);
     if (Optr == ProtoCore.DSASM.Operator.assign)
     {
         //so do we set dependency between LeftNode and '=' or LeftNode and RightNode : may be later is better
         if (AssignNodeDependencyEnabled)
         {
             //if we have enabled the '=' node to be a part of depencency, then we already handled RHS as a contingent
             //so skip it
             tracker.AddNode(LeftNode);
             tracker.AddDirectContingent(LeftNode, this);
             tracker.AddDirectDependent(this, LeftNode);
         }
         else
         {
             //if(AssignNodeDependencyEnabledLame)
             //{
             //    tracker.AddDirectContingent(this, RightNode);  //? still keep in dependency?
             //    tracker.AddDirectContingent(LeftNode, RightNode);
             //}
             tracker.AddNode(RightNode);
             tracker.AddNode(LeftNode);
             tracker.AddDirectContingent(LeftNode, RightNode);
             tracker.AddDirectDependent(RightNode, LeftNode);
             RightNode.GenerateDependencyGraph(tracker);
         }
     }
 }
 public static void GenerateDependencyGraph(this DependencyTracker tracker, List <Node> ast)
 {
     foreach (Node t in ast)
     {
         GenerateDependencyGraph(tracker, t);
     }
 }
Exemple #3
0
        public DependencyPass.DependencyTracker GetDemoTracker2(ProtoCore.Core core)
        {
            Associative.Scanner s = new Associative.Scanner(@"..\..\Scripts\expr.ds");
            Associative.Parser p = new Associative.Parser(s, core);
            p.Parse();

            CodeBlockNode code = p.codeblock as CodeBlockNode;

            DependencyTracker tempTracker = new DependencyTracker();
            Dictionary<string, List<Node>> names = new Dictionary<string, List<Node>>();
            code.ConsolidateNames(ref(names));
            tempTracker.GenerateDependencyGraph(code.Body);
            return tempTracker;
        }
Exemple #4
0
        public DependencyPass.DependencyTracker GetDemoTracker2(ProtoCore.Core core)
        {
            Associative.Scanner s = new Associative.Scanner(@"..\..\Scripts\expr.ds");
            Associative.Parser  p = new Associative.Parser(s, core);
            p.Parse();

            CodeBlockNode code = p.codeblock as CodeBlockNode;

            DependencyTracker tempTracker           = new DependencyTracker();
            Dictionary <string, List <Node> > names = new Dictionary <string, List <Node> >();

            code.ConsolidateNames(ref (names));
            tempTracker.GenerateDependencyGraph(code.Body);
            return(tempTracker);
        }
Exemple #5
0
        public virtual void GenerateDependencyGraph(DependencyTracker tracker)
        {
            tracker.AddNode(this);//get rid of this later

            IEnumerable <Node> contingents = getContingents();

            foreach (Node node in contingents)
            {
                tracker.AddNode(node);
                if (node == null)
                {
                    continue;
                }
                tracker.AddDirectContingent(this, node);
                tracker.AddDirectDependent(node, this);
                node.GenerateDependencyGraph(tracker);
            }
        }
Exemple #6
0
        public DependencyPass.DependencyTracker GetDemoTracker3(out ProtoCore.DSASM.SymbolTable symbols, string pathFilename, ProtoCore.Core core)
        {
            Associative.Scanner s = new Associative.Scanner(pathFilename);
            Associative.Parser p = new Associative.Parser(s, core); 
            p.Parse();
            CodeBlockNode code = p.codeblock as CodeBlockNode;
            symbols = code.symbols;
            
            DependencyTracker tempTracker = new DependencyTracker();

#if TEST_DIRECT
            foreach (Node node in code.Body)
            {
                tempTracker.AllNodes.Add(node);
            }
#else
            Dictionary<string, List<Node>> names = new Dictionary<string, List<Node>>();
            code.ConsolidateNames(ref(names));
            tempTracker.GenerateDependencyGraph(code.Body);
#endif
            return tempTracker;
        }
Exemple #7
0
        public DependencyPass.DependencyTracker GetDemoTracker3(out ProtoCore.DSASM.SymbolTable symbols, string pathFilename, ProtoCore.Core core)
        {
            Associative.Scanner s = new Associative.Scanner(pathFilename);
            Associative.Parser  p = new Associative.Parser(s, core);
            p.Parse();
            CodeBlockNode code = p.codeblock as CodeBlockNode;

            symbols = code.symbols;

            DependencyTracker tempTracker = new DependencyTracker();

#if TEST_DIRECT
            foreach (Node node in code.Body)
            {
                tempTracker.AllNodes.Add(node);
            }
#else
            Dictionary <string, List <Node> > names = new Dictionary <string, List <Node> >();
            code.ConsolidateNames(ref (names));
            tempTracker.GenerateDependencyGraph(code.Body);
#endif
            return(tempTracker);
        }
Exemple #8
0
 public override void GenerateDependencyGraph(DependencyTracker tracker)
 {
     base.GenerateDependencyGraph(tracker);
     if (Optr == ProtoCore.DSASM.Operator.assign)
     {
         //so do we set dependency between LeftNode and '=' or LeftNode and RightNode : may be later is better
         if (AssignNodeDependencyEnabled)
         {
             //if we have enabled the '=' node to be a part of depencency, then we already handled RHS as a contingent
             //so skip it
             tracker.AddNode(LeftNode);
             tracker.AddDirectContingent(LeftNode, this);
             tracker.AddDirectDependent(this, LeftNode);
         }
         else
         {
             //if(AssignNodeDependencyEnabledLame)
             //{
             //    tracker.AddDirectContingent(this, RightNode);  //? still keep in dependency?
             //    tracker.AddDirectContingent(LeftNode, RightNode); 
             //}
             tracker.AddNode(RightNode);
             tracker.AddNode(LeftNode);
             tracker.AddDirectContingent(LeftNode, RightNode);
             tracker.AddDirectDependent(RightNode, LeftNode);
             RightNode.GenerateDependencyGraph(tracker);
         }
     }
 }
Exemple #9
0
        public virtual void GenerateDependencyGraph(DependencyTracker tracker)
        {
            tracker.AddNode(this);//get rid of this later

            IEnumerable<Node> contingents = getContingents();
            
            foreach (Node node in contingents)
            {
                tracker.AddNode(node);
                if (node == null)
                    continue;
                tracker.AddDirectContingent(this, node);
                tracker.AddDirectDependent(node, this);
                node.GenerateDependencyGraph(tracker);
            }
        }
 public static void GenerateDependencyGraph(this DependencyTracker tracker, Node t)
 {
     t.GenerateDependencyGraph(tracker);
 }