public void Execute(List <Expression> instruction) { //Eliminar keyword de tipo IExecutable. No lo necesito para compilar. instruction.RemoveAt(0); if (SyntacticAnalysis(instruction)) { string nameVariable = instruction[0].ToString(); //Solo trabajar con las expresiones de la derecha del = instruction.RemoveAt(0); instruction.RemoveAt(0); //Si es un tipo Text y del operador =, y no hay mas tokens if (instruction.Count == 1 && (instruction[0] is Text)) { Memory.ChangeText(nameVariable, (instruction[0] as Text).Value); } //Es un tipo number else { FunctionArithmetic ecuation = ConvertToConditionalFunction.FetchFunction(instruction); //Guardar variable en la memoria if (ecuation != null) { Memory.ChangeVariable(nameVariable, ecuation.Evaluate(0)); } } } }
public void Execute(List <Expression> instruction) { //Eliminar keyword de tipo IExecutable. No lo necesito para compilar. instruction.RemoveAt(0); if (SyntacticAnalysis(instruction)) { ConditionalFunction functionGraph = ConvertToConditionalFunction.FetchFunction(instruction); if (functionGraph != null) { Random rn = new Random((Environment.TickCount + instruction.GetHashCode()) % int.MaxValue); float pp = functionGraph.Evaluate(5); Display._fViewer.Functions.Add(new XControls.FunctionInfo() { Name = "f" + Environment.TickCount.ToString(), Function = x => functionGraph.Evaluate(x), Color = Color.FromArgb(rn.Next(255), rn.Next(255), rn.Next(255)) }); Display.onActivateGraph = true; } } }
public void Execute(List <Expression> instruction) { //Eliminar keyword de tipo IExecutable. No lo necesito para compilar. instruction.RemoveAt(0); if (SyntacticAnalysis(instruction)) { FunctionArithmetic tempFunction = ConvertToConditionalFunction.FetchFunction(instruction); if (tempFunction != null) { //Guardar la funcion Memory.SaveFunction(name, ConvertToConditionalFunction.FetchFunction(instruction)); } } }
public void Execute(List <Expression> instruction) { //Eliminar keyword de tipo IExecutable. No lo necesito para compilar. instruction.RemoveAt(0); if (SyntacticAnalysis(instruction)) { if (instruction.Count == 1 && (instruction[0] is Text)) { if ((instruction[0] as Text).isOnlyText) { Display._output.Text += string.Format("{0}\n", (instruction[0] as Text).Value); } else { Display._output.Text += string.Format("{0}\n", Memory.GetText((instruction[0] as Text).Name)); } } else { FunctionArithmetic ecuation = ConvertToConditionalFunction.FetchFunction(instruction); float toShow = 0; if (ecuation != null) { toShow = ecuation.Evaluate(0); } if (!Compiler._haveError) { Display._output.Text += string.Format("{0}\n", toShow); } } } }