Example #1
0
    def begin(self):
        self.inferencer = type_inference.TypeInferencer()        
        
        '''
        while self.passCount < self.maxPasses:
            fname = 'projects/housewifewars/prueba.as'
            if self.passCount == 0:
                print 'Parsing file : %s'%(fname)
                data = open(fname).read()    
                prog = asyacc.parse(data)
                self.programs[fname] = prog
                self.inferencer.checkTypes(prog)
            else:
                self.compile(fname)
            self.passCount += 1
        return
        '''
    
        while self.passCount < self.maxPasses:
            print "Pass: ", self.passCount
            errors = 0
            for dirname, dirnames, filenames in os.walk('projects/housewifewars'):
                for filename in filenames:
                    if filename[-3:] == '.as':
                        fname = '%s/%s'%(dirname, filename)

                        if self.passCount == 0:
                            print 'Parsing file : %s'%(fname)
                            data = open(fname).read()    
                            prog = asyacc.parse(data)
                            self.programs[fname] = prog
                            self.inferencer.checkTypes(self.programs[fname])
                        elif self.passCount == 1:
                            self.inferencer.checkTypes(self.programs[fname])
                        else:
                            errors += self.compile(dirname, filename)
            print 'Total errors: ', errors
            self.passCount += 1
        return