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

            return(new IdentifierNode(tempName));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
 public GraphNodeToASTGenerator(AST graph, GraphCompiler gc)
 {
     this.graph = graph;
     this.gc    = gc;
 }