public void Visit(InputStatementNode input) { foreach (var target in input.TargetVariables) { EmitComment("Input to " + target.Variable.Name); Emit("getstatic", "VslMain/scanner", "Ljava/util/Scanner;"); Emit("invokevirtual", "java/util/Scanner/nextInt()I"); Emit("istore", GetLocalsIndex(target.SymbolTableEntry)); } }
public void Visit(InputStatementNode input) { string pattern = "{0}[{1}] = +prompt(\"Please enter an integer:\");"; foreach (var target in input.TargetVariables) { if (target.SymbolTableEntry.Type == SymbolTableEntryType.Variable) { Emit(pattern, "locals", target.SymbolTableEntry.Index); } else { Emit(pattern, "params", target.SymbolTableEntry.Index); } } }
public void Visit(InputStatementNode input) { foreach (var target in input.TargetVariables) { EmitComment("Input to " + target.Variable.Name); Emit("call", "string [mscorlib]System.Console::ReadLine()"); Emit("call", "int32 [mscorlib]System.Int32::Parse(string)"); if (target.SymbolTableEntry.Type == SymbolTableEntryType.Variable) { Emit("stloc", target.SymbolTableEntry.Index); } else // Parameter { Emit("starg", target.SymbolTableEntry.Index); } } }
public void Visit(InputStatementNode input) { foreach (var target in input.TargetVariables) { EmitComment("Input to " + target.Variable.Name); Emit("getstatic", "VslMain/scanner", "Ljava/util/Scanner;"); Emit("invokevirtual", "java/util/Scanner/nextInt()I"); Emit("istore", GetLocalsIndex(target.SymbolTableEntry)); } }
public void Visit(InputStatementNode input) { foreach (var target in input.TargetVariables) { EmitComment("Input to " + target.Variable.Name); Emit("call", "string [mscorlib]System.Console::ReadLine()"); Emit("call", "int32 [mscorlib]System.Int32::Parse(string)"); if (target.SymbolTableEntry.Type == SymbolTableEntryType.Variable) Emit("stloc", target.SymbolTableEntry.Index); else // Parameter Emit("starg", target.SymbolTableEntry.Index); } }
public void Visit(InputStatementNode input) { string pattern = "{0}[{1}] = +prompt(\"Please enter an integer:\");"; foreach (var target in input.TargetVariables) { if (target.SymbolTableEntry.Type == SymbolTableEntryType.Variable) Emit(pattern, "locals", target.SymbolTableEntry.Index); else Emit(pattern, "params", target.SymbolTableEntry.Index); } }