Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }