Ejemplo n.º 1
0
        public void Run(DuAnalyzedProject project)
        {
            Logger.LogMessage("INTERPRETATING...", Logger.LogLevel.Warning);
            ConsoleHandler.Global.WriteLine(new string('-', 30));

            ctx = new InterpretatorContext()
            {
                Project = project
            };

            project.AnalysedCode.InvokeForAll(s =>
            {
                ctx.ExecutablesIterators.Add(-1);

                for (int i = 0; i < s.Executables.Count; i++)
                {
                    ctx.ExecutablesIterators[0] = i;
                    s.Executables[i].OnStart(ctx);
                }

                ctx.ExecutablesIterators.RemoveAt(0);
            });

            var main = project.AnalysedCode[0];

            ctx.ExecutablesIterators.Clear();

            Execute(new NullBlock(main.Executables, null));

            Logger.LogMessage("Program has finished", Logger.LogLevel.Console);
        }
Ejemplo n.º 2
0
		private static object GetValueFromOperand(string operand, InterpretatorContext ctx)
		{
			if(operand.StartsWith("$"))
			{
				return ctx.GetVariable(operand[1..]).CurrentValue;