예제 #1
0
        public bool LoadAndCompile(string code, string fileNameHint = null)
        {
            Stopwatch watch = Stopwatch.StartNew();

            Reinit();
            Host.InitRun(this);
            var comp = BasicCompiler.Parse(code, fileNameHint);

            this.CompilerErrors = comp.Errors;
            this.program        = comp.Program;
            this.lines          = program.Lines;
            this.data           = program.Data;
            if (CompilerErrors.Count == 0)
            {
                Link();
            }
            if (CompilerErrors.Count > 0)
            {
                comp.DumpErrors((s) => Trace.WriteLine(s));
                return(false);
            }

            watch.Stop();
            if (WriteCompileRunMessage)
            {
                printer.WriteMessage($"=== {lines.Length} lines compiled into {program.CalcNodeCount():###,##0} nodes in {watch.ElapsedMilliseconds} ms ===");
            }

            return(true);
        }
예제 #2
0
        void RusBas()
        {
            prog = new BasicProgram(this);

            Line();
            while (StartOf(1))
            {
                Line();
            }
        }