protected Executable Compile(string code, MachineInfo mi, params int[] expectedErrors) { var fullCode = "void start() { __cinit(); main(); } " + code; var printer = new TestPrinter(expectedErrors); var i = CLanguageService.CreateInterpreter(fullCode, mi ?? new TestMachineInfo(), printer: printer); printer.CheckForErrors(); return(i.Executable); }
protected CInterpreter Run(string code, MachineInfo mi, params int[] expectedErrors) { var fullCode = "void start() { __cinit(); main(); } " + code; var printer = new TestPrinter(expectedErrors); var i = CLanguageService.CreateInterpreter(fullCode, mi ?? new TestMachineInfo(), printer: printer); printer.CheckForErrors(); i.Reset("start"); i.Step(); return(i); }
Executable CompileWithErrors(string code, params int[] errorCodes) { var printer = new TestPrinter(errorCodes); var c = new Compiler(MachineInfo.Arduino, new Report(printer)); c.AddCode(code); var exe = c.Compile(); printer.CheckForErrors(); return(exe); }