// TODO: Deprecate
        private static IdentifierNode CreateTempIdentifierNode(Node node)
        {
            uint   tguid    = GraphCompiler.GetTempGUID(node.Guid);
            string tempName = GraphToDSCompiler.kw.tempPrefix + tguid;

            return(new IdentifierNode(tempName));
        }
Example #2
0
        IGraphState GetGraph()
        {
            string gfile = ss.PathToStateItem(Graph);

            try {
                if (!File.Exists(gfile))
                {
                    RecompileNoGraph(gfile);
                }
                else
                {
                    IGraphState gs = LoadSavedGraph(gfile, true);

                    if (gs != null)
                    {
                        return(gs);
                    }
                }
            } catch (Exception e) {
                log.Error(9999, "Exception trying to recover compiled graph", e.Message);
            }

            GraphBuilder gb = GraphCompiler.Compile(ss, log);

            if (gb == null)
            {
                File.Delete(gfile);
                return(null);
            }

            BinaryGraphSerializer.Write(gb, gfile);

            return(LoadSavedGraph(gfile, false));
        }
Example #3
0
        /// <summary>
        /// Transforms Node to the Final ProtoAST form
        /// </summary>
        /// <returns></returns>
        public List <AssociativeNode> ToGraphIR(AST graph, GraphCompiler graphCompiler)
        {
            GraphNodeToASTGenerator astGen = new GraphNodeToASTGenerator(graph, graphCompiler);

            astGen.AddNodesToAST();
            List <ProtoCore.AST.AssociativeAST.AssociativeNode> irGraph = astGen.SplitAST();


            return(irGraph);
        }
Example #4
0
        /*Tron*/
        public List <SnapshotNode> PrintCodeForSelectedNodes(GraphCompiler originalGC, List <SnapshotNode> inputs)
        {
            this.AddNodesToAST();
            this.MakeConnectionsForAddedNodes();
            bool removeFromRemovedNodes = true;

            this.RemoveNodes(removeFromRemovedNodes);
            this.UpdateModifiedNodes();
            //List<string> code = this.gc.PrintGraph_NodeToCode();
            List <SnapshotNode> code = this.gc.ToCode(this.gc.Graph, originalGC, inputs);

            gc.UpdateDirtyFlags(nodesToModify);
            return(code);
        }
        public void BuildGraphFromNodes(List <SnapshotNode> snapshotNodeList)
        {
            // Instantiate SynchronizeData and GraphCompiler
            SynchronizeData syncData = new SynchronizeData();

            syncData.AddedNodes = snapshotNodeList;

            GraphCompiler gc = GraphToDSCompiler.GraphCompiler.CreateInstance();
            GraphBuilder  gb = new GraphBuilder(syncData, gc);

            gb.AddNodesToAST();
            gb.MakeConnectionsForAddedNodes();

            graph = gb.Graph;
        }
 public GraphNodeToASTGenerator(AST graph, GraphCompiler gc)
 {
     this.graph = graph;
     this.gc    = gc;
 }