private void GetVariables() { string[] dataLines = assemblyCode.GetDataLines(); for (int i = 0; i < dataLines.Length; i++) { string line = LineFormatter.FormatDataLine(dataLines[i]); if (VariableManager.IsVariable(line)) { string[] pair = line.Split(new char[] { ' ' }, 2); string value; if (line.Equals("' '")) { value = line; } else if (pair.Length == 1) { value = pair[0]; } else { variableManager.AddVariable(pair[0], memoryCounter.ToString()); value = pair[1]; } AddInitVariableInstruction(value); } } }
public string Interpret(string code) { assemblyCode = new AssemblyCode(code); labelManager = new LabelManager(); variableManager = new VariableManager(); instructions = new List <Instruction>(); GetVariables(); GetLabels(); ProcessCode(); return(null); }
public string Interpret(string code) { assemblyCode = new AssemblyCode(code); labelManager = new LabelManager(); variableManager = new VariableManager(); instructions = new List<Instruction>(); GetVariables(); GetLabels(); ProcessCode(); return null; }