Esempio n. 1
0
 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
Esempio n. 2
0
 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
Esempio n. 3
0
 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
Esempio n. 4
0
 def test_parsing(self):
     inp = open(EXAMPLE_0_PATH).read()
     ast = parser.parse(inp, lexer=lexer)
     syms = ast.walk(SymbolTableVisitor())
     syms.pprint()
Esempio n. 5
0
 def test_parsing(self):
     inp = open(EXAMPLE_0_PATH).read()
     ast = parser.parse(inp,lexer=lexer)
     syms = ast.walk( SymbolTableVisitor() )
     syms.pprint()