def testPrintVisitor(self): src = Source('./tests/test.minipl') scanner = Scanner(src) parser = Parser(scanner) ast = parser.program() pv = PrintVisitor() ast.accept(pv)
def testTypeCheckVisitor(self): return src = Source('./tests/test.minipl') scanner = Scanner(src) parser = Parser(scanner) ast = parser.program() tc = TypeCheck() ast.accept(tc)
def __createAstAndVisitor__(self, lines): src = MockSource(lines) scanner = Scanner(src) parser = Parser(scanner) ast = parser.program() tc = TypeCheck() ast.accept(tc) iv = InterpretingVisitor(tc.symbolTable) return ast, iv
def testInterpretingVisitorWithAFile(self, output, input): src = Source('./tests/test.minipl') scanner = Scanner(src) parser = Parser(scanner) ast = parser.program() tc = TypeCheck() ast.accept(tc) iv = InterpretingVisitor(tc.symbolTable) ast.accept(iv) output.assert_called_with('120')
def setup(filename): src = Source(filename) scanner = Scanner(src) parser = Parser(scanner) ast = parser.program() return ast, parser.errors
def testParser(self): src = Source('./tests/test.minipl') scanner = Scanner(src) parser = Parser(scanner) parser.program()
def __createAST__(self, lines): src = MockSource(lines) scanner = Scanner(src) parser = Parser(scanner) return parser.program(), parser