Esempio n. 1
0
 public override void Emit_Code(generate_interface.typ gen)
 {
     if (this.parse_tree != null)
     {
         if (this.is_input)
         {
             if (!this.input_is_expression)
             {
                 parse_tree_pkg.set_prompt(this.prompt);
             }
             else
             {
                 parse_tree_pkg.set_prompt(null);
                 // maintain with parse_tree.adb
                 gen.Variable_Assignment_Start("raptor_prompt_variable_zzyz");
                 interpreter_pkg.emit_code(
                     ((parse_tree.expr_output) this.prompt_tree).expr,
                     this.prompt, gen);
                 gen.Variable_Assignment_PastRHS();
             }
         }
         interpreter_pkg.emit_code(this.parse_tree, this.Text, gen);
     }
     if (this.Successor != null)
     {
         this.Successor.Emit_Code(gen);
     }
 }
Esempio n. 2
0
		public virtual void compile_pass1(generate_interface.typ gen)
		{	
			if (this.parse_tree!=null)
			{
				interpreter_pkg.compile_pass1(this.parse_tree,this.Text,gen);
			}
			if (this.Successor!=null)
			{
				this.Successor.compile_pass1(gen);
			}
		}
Esempio n. 3
0
		public virtual void Emit_Code(generate_interface.typ gen)
		{	
			if (this.parse_tree!=null)
			{
				interpreter_pkg.emit_code(this.parse_tree,this.Text,gen);
			}
			if (this.Successor!=null)
			{
				this.Successor.Emit_Code(gen);
			}
		}
Esempio n. 4
0
 public override void compile_pass1(generate_interface.typ gen)
 {
     if (this.parse_tree != null & this.is_input && this.input_is_expression)
     {
         // maintain with parse_tree.adb
         if (!Compile_Helpers.Start_New_Declaration("raptor_prompt_variable_zzyz"))
         {
             gen.Declare_String_Variable("raptor_prompt_variable_zzyz");
         }
     }
     base.compile_pass1(gen);
 }
Esempio n. 5
0
 public override void Emit_Code(generate_interface.typ gen)
 {
     if (this.parse_tree != null)
     {
         parse_tree.expr_output eo = this.parse_tree as parse_tree.expr_output;
         ((generate_interface_oo.typ)gen).start_return();
         interpreter_pkg.emit_code(eo.expr, this.Text, gen);
         ((generate_interface_oo.typ)gen).end_return();
     }
     if (this.Successor != null)
     {
         this.Successor.Emit_Code(gen);
     }
 }
Esempio n. 6
0
        public static generate_interface.typ Create_From_Menu(string name, string filename)
        {
            System.Type            type        = Generator_List[name];
            System.Type[]          param_types = new Type[1];
            generate_interface.typ result      = null;

            object[] parameters = new object[1];
            param_types[0] = typeof(string);
            System.Reflection.ConstructorInfo constructor = type.GetConstructor(param_types);
            parameters[0] = filename;
            result        = constructor.Invoke(parameters) as generate_interface.typ;


            return(result);
        }
Esempio n. 7
0
        public override void compile_pass1(generate_interface.typ gen)
        {
            if (this.kind == Kind_Of.Call &&
                ((parse_tree.procedure_call) this.parse_tree).is_tab_call())
            {
                string call_name = interpreter_pkg.get_name_call(this.parse_tree as parse_tree.procedure_call,
                                                                 this.Text);
                Subchart sub = Find_Start(call_name);
                if (!(sub is Procedure_Chart))
                {
                    if (sub.am_compiling)
                    {
                        throw new System.Exception("The RAPTOR compiler does not support recursive programs.\n" +
                                                   "Recursion found at call to: " + this.Text + "\n" +
                                                   "Cycle of calls includes: " + Recursion_Involves());
                    }
                    sub.am_compiling = true;
                    sub.Start.compile_pass1(gen);
                    sub.am_compiling = false;
                }
                else
                {
                    Procedure_Chart           pc   = sub as Procedure_Chart;
                    parse_tree.parameter_list walk = ((parse_tree.procedure_call) this.parse_tree).param_list;
                    for (int i = 0; i < pc.num_params; i++)
                    {
                        // it seems like we would want to call pass1 on our parameters
                        // but this may give us the mistaken impression that an array is a variable
                        // if it is passed

                        //    walk.parameter.compile_pass1(gen);
                        walk = walk.next;
                    }
                }
            }
            else if (this.parse_tree != null)
            {
                interpreter_pkg.compile_pass1(this.parse_tree, this.Text, gen);
            }
            if (this.Successor != null)
            {
                this.Successor.compile_pass1(gen);
            }
        }
Esempio n. 8
0
 public override void compile_pass1(generate_interface.typ gen)
 {
     if (this.parse_tree != null)
     {
         interpreter_pkg.compile_pass1(this.parse_tree, this.Text, gen);
     }
     if (this.first_child != null)
     {
         this.first_child.compile_pass1(gen);
     }
     if (this.second_child != null)
     {
         this.second_child.compile_pass1(gen);
     }
     if (this.Successor != null)
     {
         this.Successor.compile_pass1(gen);
     }
 }
Esempio n. 9
0
 public static void Do_Compilation(Oval start, generate_interface.typ gil,
                                   TabControl.TabPageCollection tpc)
 {
     if (Component.Current_Mode != Mode.Expert)
     {
         Do_Compilation_Imperative(start, gil as GeneratorAda.Imperative_Interface, tpc);
     }
     else
     {
         try
         {
             Do_Compilation_OO(start, gil as GeneratorAda.OO_Interface, tpc);
         }
         catch
         {
             (gil as GeneratorAda.OO_Interface).abort();
             throw;
         }
     }
 }
Esempio n. 10
0
        public override void Emit_Code(generate_interface.typ gen)
        {
            object o;

            parse_tree.boolean_expression be = this.parse_tree as parse_tree.boolean_expression;
            if (Component.reverse_loop_logic)
            {
                o = gen.Loop_Start(this.before_Child == null, true);
            }
            else
            {
                bool negated = be.top_level_negated();
                o = gen.Loop_Start(this.before_Child == null,
                                   negated);
                if (negated)
                {
                    be = be.remove_negation();
                }
            }
            if (this.before_Child != null)
            {
                this.before_Child.Emit_Code(gen);
            }
            gen.Loop_Start_Condition(o);

            if (this.parse_tree != null)
            {
                interpreter_pkg.emit_code(be, this.Text, gen);
            }
            gen.Loop_End_Condition(o);
            if (this.after_Child != null)
            {
                this.after_Child.Emit_Code(gen);
            }
            gen.Loop_End(o);

            if (this.Successor != null)
            {
                this.Successor.Emit_Code(gen);
            }
        }
Esempio n. 11
0
 public override void Emit_Code(generate_interface.typ gen)
 {
     if (this.kind == Kind_Of.Call &&
         ((parse_tree.procedure_call) this.parse_tree).is_tab_call())
     {
         string call_name = interpreter_pkg.get_name_call(this.parse_tree as parse_tree.procedure_call,
                                                          this.Text);
         Subchart called_chart = Find_Start(call_name);
         if (!(called_chart is Procedure_Chart))
         {
             called_chart.Start.Emit_Code(gen);
         }
         else
         {
             Procedure_Chart           pc   = called_chart as Procedure_Chart;
             parse_tree.parameter_list walk = ((parse_tree.procedure_call) this.parse_tree).param_list;
             object o = gen.Emit_Call_Subchart(pc.Text);
             for (int i = 0; i < pc.num_params; i++)
             {
                 parse_tree_pkg.emit_parameter_number(walk.parameter, gen, 0);
                 walk = walk.next;
                 if (walk != null)
                 {
                     gen.Emit_Next_Parameter(o);
                 }
             }
             gen.Emit_Last_Parameter(o);
         }
     }
     else if (this.parse_tree != null)
     {
         interpreter_pkg.emit_code(this.parse_tree, this.Text, gen);
     }
     if (this.Successor != null)
     {
         this.Successor.Emit_Code(gen);
     }
 }
Esempio n. 12
0
        public override void Emit_Code(generate_interface.typ gen)
        {
            object o = gen.If_Start();

            if (this.parse_tree != null)
            {
                interpreter_pkg.emit_code(this.parse_tree, this.Text, gen);
            }
            gen.If_Then_Part(o);
            if (this.yes_child != null)
            {
                this.yes_child.Emit_Code(gen);
            }
            gen.If_Else_Part(o);
            if (this.no_child != null)
            {
                this.no_child.Emit_Code(gen);
            }
            gen.If_Done(o);
            if (this.Successor != null)
            {
                this.Successor.Emit_Code(gen);
            }
        }