コード例 #1
0
        private ProtoLanguage.CompileStateTracker Compile(out int blockId)
        {
            blockId = ProtoCore.DSASM.Constants.kInvalidIndex;

            compileState = ProtoScript.CompilerUtils.BuildDebuggertCompilerState();
            compileState.CurrentDSFileName = core.CurrentDSFileName;
            try
            {
                //defining the global Assoc block that wraps the entire .ds source file
                ProtoCore.LanguageCodeBlock globalBlock = new ProtoCore.LanguageCodeBlock();
                globalBlock.language = ProtoCore.Language.kAssociative;
                globalBlock.body     = code;
                //the wrapper block can be given a unique id to identify it as the global scope
                globalBlock.id = ProtoCore.LanguageCodeBlock.OUTERMOST_BLOCK_ID;

                //passing the global Assoc wrapper block to the compiler
                ProtoCore.CompileTime.Context context = new ProtoCore.CompileTime.Context();
                ProtoCore.Language            id      = globalBlock.language;



                compileState.Executives[id].Compile(compileState, out blockId, null, globalBlock, context, EventSink);

                compileState.BuildStatus.ReportBuildResult();

                int errors   = 0;
                int warnings = 0;
                compileState.compileSucceeded = compileState.BuildStatus.GetBuildResult(out errors, out warnings);


                // This is the boundary between compilestate and runtime core
                // Generate the executable
                compileState.GenerateExecutable();

                // Get the executable from the compileState
                core.DSExecutable = compileState.DSExecutable;

                core.Rmem.PushGlobFrame(compileState.GlobOffset);
            }
            catch (Exception ex)
            {
                Messages.FatalCompileError fce = new Messages.FatalCompileError {
                    Message = ex.ToString()
                };

                Console.WriteLine(fce.Message);
                return(null);
            }

            return(compileState);
        }
コード例 #2
0
ファイル: DebugRunner.cs プロジェクト: santom/designscript
        private bool Compile(out int blockId)
        {
            bool buildSucceeded = false;

            blockId = ProtoCore.DSASM.Constants.kInvalidIndex;
            try
            {
                //defining the global Assoc block that wraps the entire .ds source file
                ProtoCore.LanguageCodeBlock globalBlock = new ProtoCore.LanguageCodeBlock();
                globalBlock.language = ProtoCore.Language.kAssociative;
                globalBlock.body     = code;
                //the wrapper block can be given a unique id to identify it as the global scope
                globalBlock.id = ProtoCore.LanguageCodeBlock.OUTERMOST_BLOCK_ID;

                //passing the global Assoc wrapper block to the compiler
                ProtoCore.CompileTime.Context context = new ProtoCore.CompileTime.Context();
                ProtoCore.Language            id      = globalBlock.language;
                core.Executives[id].Compile(out blockId, null, globalBlock, context, EventSink);

                core.BuildStatus.ReportBuildResult();

                int errors   = 0;
                int warnings = 0;
                buildSucceeded = core.BuildStatus.GetBuildResult(out errors, out warnings);
                core.GenerateExecutable();
                core.Rmem.PushGlobFrame(core.GlobOffset);
            }
            catch (Exception ex)
            {
                Messages.FatalCompileError fce = new Messages.FatalCompileError {
                    Message = ex.ToString()
                };

                Console.WriteLine(fce.Message);
                return(false);
            }

            return(buildSucceeded);
        }
コード例 #3
0
ファイル: DebugRunner.cs プロジェクト: joespiff/Dynamo
        private bool Compile(out int blockId)
        {
            bool buildSucceeded = false;
            blockId = ProtoCore.DSASM.Constants.kInvalidIndex;
            try
            {
                //defining the global Assoc block that wraps the entire .ds source file
                ProtoCore.LanguageCodeBlock globalBlock = new ProtoCore.LanguageCodeBlock();
                globalBlock.language = ProtoCore.Language.kAssociative;
                globalBlock.body = code;
                //the wrapper block can be given a unique id to identify it as the global scope
                globalBlock.id = ProtoCore.LanguageCodeBlock.OUTERMOST_BLOCK_ID;

                //passing the global Assoc wrapper block to the compiler
                ProtoCore.CompileTime.Context context = new ProtoCore.CompileTime.Context();
                ProtoCore.Language id = globalBlock.language;
                core.Compilers[id].Compile(out blockId, null, globalBlock, context);

                core.BuildStatus.ReportBuildResult();

                buildSucceeded = core.BuildStatus.BuildSucceeded;
                core.GenerateExecutable();

            }
            catch (Exception ex)
            {
                Messages.FatalCompileError fce = new Messages.FatalCompileError { Message = ex.ToString() };

                Console.WriteLine(fce.Message);
                return false;
            }

            return buildSucceeded;
        }
コード例 #4
0
ファイル: DebugRunner.cs プロジェクト: samuto/designscript
        private ProtoLanguage.CompileStateTracker Compile(out int blockId)
        {
            blockId = ProtoCore.DSASM.Constants.kInvalidIndex;

            compileState = ProtoScript.CompilerUtils.BuildDebuggertCompilerState();

            try
            {
                //defining the global Assoc block that wraps the entire .ds source file
                ProtoCore.LanguageCodeBlock globalBlock = new ProtoCore.LanguageCodeBlock();
                globalBlock.language = ProtoCore.Language.kAssociative;
                globalBlock.body = code;
                //the wrapper block can be given a unique id to identify it as the global scope
                globalBlock.id = ProtoCore.LanguageCodeBlock.OUTERMOST_BLOCK_ID;

                //passing the global Assoc wrapper block to the compiler
                ProtoCore.CompileTime.Context context = new ProtoCore.CompileTime.Context();
                ProtoCore.Language id = globalBlock.language;

                compileState.Executives[id].Compile(compileState, out blockId, null, globalBlock, context, EventSink);

                compileState.BuildStatus.ReportBuildResult();

                int errors = 0;
                int warnings = 0;
                compileState.compileSucceeded = compileState.BuildStatus.GetBuildResult(out errors, out warnings);

                // This is the boundary between compilestate and runtime core
                // Generate the executable
                compileState.GenerateExecutable();

                // Get the executable from the compileState
                core.DSExecutable = compileState.DSExecutable;

                core.Rmem.PushGlobFrame(compileState.GlobOffset);

            }
            catch (Exception ex)
            {
                Messages.FatalCompileError fce = new Messages.FatalCompileError { Message = ex.ToString() };

                Console.WriteLine(fce.Message);
                return null;
            }

            return compileState;
        }