Ejemplo n.º 1
0
        static void debug()
        {
            var log_settings = new Script.LogSettings();

            log_settings.print_tokens            = true;
            log_settings.print_intermediate_code = true;
            log_settings.print_statements        = true;

            var script = Script.load_from_file("script.py", log_settings);

            var run_time = new RunTime(script);

            Console.WriteLine("\n\n");

            bool end = false;

            while (end == false)
            {
                // Console.WriteLine(run_time.ToString() + "\n");
                end = run_time.run(1);
            }
        }
Ejemplo n.º 2
0
        public ExtensionExample()
        {
            var log_settings = new Script.LogSettings();

            log_settings.print_tokens            = true;
            log_settings.print_intermediate_code = true;
            log_settings.print_statements        = true;

            var script = Script.load_from_file("extension_examples.py", log_settings);

            var run_time = new RunTime(script);

            run_time.add_function("user_add", user_add);
            run_time.add_function("UserSum", UserSum);

            // ---------------------------------------------
            // Variable Initialization
            run_time.symbol_table.store("a", new DynamicValue(1));
            run_time.symbol_table.store("b", new DynamicValue(2));

            Console.WriteLine("\n\n");
            run_time.run();
        }