def compile(self, file): input = file.read() ast = parser.parse(input, lexer=lexer) with Capturing() as output: ast.pprint() out = [k.strip() for k in output] self.out = out
def compile(self, file): input = file.read() # Lexing, parsing, AST construction ast = parser.parse(input, lexer=lexer) # Semantic analysis ast.walk( CheckSingleAssignment() ) # Translation syms = ast.walk( SymbolTableVisitor()) syms.pprint() return syms
def test_parsing(self): inp = open(EXAMPLE_0_PATH).read() ast = parser.parse(inp, lexer=lexer) syms = ast.walk(SymbolTableVisitor()) syms.pprint()
def test_parsing(self): inp = open(EXAMPLE_0_PATH).read() ast = parser.parse(inp,lexer=lexer) syms = ast.walk( SymbolTableVisitor() ) syms.pprint()