Commits

ebo  committed 6242f84

Changed generation method of ArithIntegerGenerator to be in line with the rest of the generators.

  • Participants
  • Parent commits 2243815

Comments (0)

Files changed (4)

File codegen/integergen.py

         branch = eval_branches(self.rng, opts["children"])
         if branch == "arith_integer":
             gen  = ArithIntegerGenerator(self.module, self.stats, self.opts, self.rng)
-            c = gen.arith_integer(opts, 2)
+            c = gen.generate(opts, 2)
             self.module.content.insert(0, c)
 
             args = self.rng.sample(list(literals), 2)
 
         if branch == ("arith_integer", "local"):
             gen  = ArithIntegerGenerator(self.module, self.stats, self.opts, self.rng)
-            c = gen.arith_integer(opts, 2, list(literals))
+            c = gen.generate(opts, 2, list(literals))
 
             f.content.append(c)
 
         if branch == "loop_integer":
             gen  = LoopIntegerGenerator(self.module, self.stats, self.opts, self.rng)
 
-            c = gen.loop_integer(self.opts['loop_integer'], 2, [])
+            c = gen.generate(self.opts['loop_integer'], 2, [])
             self.module.content.insert(0, c)
 
             args = self.rng.sample(list(literals), 2)
 
 
 
-    def arith_integer(self, opts, args_num, globals=[]):
+    def generate(self, opts, args_num, globals=[]):
         '''Insert a new arithmetic function using only integers'''
         args = self.generate_arguments(args_num)
         
         iter_gen = IterableGenerator(self.module, self.stats, self.opts, self.rng)
         return iter_gen.get_iterable(literals)
 
-    def loop_integer(self, opts, args_num, globals):
+    def generate(self, opts, args_num, globals):
         '''Insert a new function with a loop containing some integer operations'''
         args = self.generate_arguments(args_num)
  
         self.module.content.insert(1, Assignment(c_var, "=", [CallStatement(gen, [])]))
  
         gen_ai = ArithIntegerGenerator(self.module, self.stats, self.opts, self.rng)
-        f = gen_ai.arith_integer(self.opts["arith_integer"], args_num, [])
+        f = gen_ai.generate(self.opts["arith_integer"], args_num, [])
         
         self.module.content.insert(0, f)
         

File codegen/iterables.py

     def generate_child(self, func, literals):
         '''Insert a function call to calculate some numbers'''
         gen = pgen.ArithIntegerGenerator(self.module, self.stats, self.opts, self.rng)
-        c = gen.arith_integer(self.opts["arith_integer"], 2)
+        c = gen.generate(self.opts["arith_integer"], 2)
 
         self.module.content.insert(0, c)
         

File codegen/recursion.py

 
         # generate an arith_integer function
         gen  = pgen.ArithIntegerGenerator(self.module, self.stats, self.opts, self.rng)
-        c = gen.arith_integer(self.opts["arith_integer"], 2)
+        c = gen.generate(self.opts["arith_integer"], 2)
         self.module.content.insert(0, c)
 
         args = self.rng.sample(["acc", "rest"] + numbers, 2)
 
 pgen_opts = {
     "module" : {"children" : [(1.0, "arith_integer"), (0.0, "arith_float")],
-                "mainloop" : 20000, "prog_size" : 5, "module_size" : 25,
+                "mainloop" : 25000, "prog_size" : 5, "module_size" : 25,
                },
 
 
     def arith_integer(self, opts, args_num, globals=[]):
         '''Insert a new arithmetic function using only integers'''
         gen = ArithIntegerGenerator(self.module, self, self.opts, self.rng)
-        f = gen.arith_integer(opts, args_num, globals)
+        f = gen.generate(opts, args_num, globals)
 
         return f
         
-    def loop_integer(self, opts, args_num, globals):
-        '''Insert a new function with a loop containing some integer operations'''
-        gen = LoopIntegerGenerator(self.module, self, self.opts, self.rng)
-        f = gen.loop_integer(opts, args_num, globals)
 
-        return f
-
-
-
-