private static void RunFile(string path) { string source = File.ReadAllText(path, Encoding.UTF8); InterpretResult result = vm.Interpret(source); Environment.Exit((int)result); }
public InterpretException(InterpretResult result, uint exceptionLine, uint exceptionParameter, string exceptionCommand) { this.result = result; this.exceptionCommand = exceptionCommand; this.exceptionLine = exceptionLine; this.exceptionParameter = exceptionParameter; }
public void RunFile(string file) { string code = File.ReadAllText(file); InterpretResult result = Interpret(code); Console.Write("Press Any Key To Continue."); Console.Read(); }
private static void runFile(string path) { char[] source = readFile(path).ToCharArray(); InterpretResult result = run(source); clox.Memory.FREE <char>(ref source); if (result != InterpretResult.INTERPRET_OK) { System.Environment.Exit((int)result); } }
private static void runFile(string path) { char[] source = readFile(path).ToCharArray(); InterpretResult result = VM.interpret(source); Memory.FREE <char>(ref source); if (result == InterpretResult.INTERPRET_COMPILE_ERROR) { System.Environment.Exit(65); } if (result == InterpretResult.INTERPRET_RUNTIME_ERROR) { System.Environment.Exit(70); } }
public InterpretResult Interpret(string source) { Chunk chunk = new Chunk(); if (!compiler.Compile(source, ref chunk)) { return(InterpretResult.COMPILE_ERROR); } currentChunk = chunk; ip = 0; InterpretResult result = Run(); return(result); }
public static string Interpret(string term) { var interpretResult = new InterpretResult(); try { var expr = new Parser(new Scanner(term).ScanTokens()).Parse(); var result = new DiceEngine().Interpret(expr).ToString(); interpretResult.Error = null; interpretResult.Ast = new AstPrinter().Print(expr, null); interpretResult.Pretty = new PrettyPrinter().PrettyPrint(expr, null); interpretResult.Result = result; } catch (Exception e) { interpretResult.Error = e.Message; } return(JsonConvert.SerializeObject(interpretResult, Settings)); }
public InterpretException(InterpretResult result, uint exceptionLine) { this.result = result; this.exceptionCommand = ""; this.exceptionLine = exceptionLine; this.exceptionParameter = 0; }