Ejemplo n.º 1
0
        private static void Run(string source)
        {
            TokenList tokens = new Tokenizer(source).ScanTokens();

            if (Compiler.TryCompile(tokens, out GearsChunk chunk, out string status))
            {
                using (BinaryFileWriter writer = new BinaryFileWriter("compiled.lxx")) {
                    chunk.Serialize(writer);
                    writer.Close();
                }
                Gears gears = new Gears();
                gears.Reset(chunk);
                gears.AddNativeObject("TestObj", new TestNativeObject());
                gears.Disassemble(chunk);
                Console.WriteLine("Press enter to run.");
                Console.ReadKey();
                gears.Run();
            }
        }