Commits

Maciej Fijalkowski committed d5aacfa

enough to pass the first test

Comments (0)

Files changed (2)

kermit/sourceparser.py

     to something easier to work with
     """
     def visit_main(self, node):
+        return Block([self.visit_stmt(node.children[0].children[0])])
+
+    def visit_stmt(self, node):
+        return Stmt(self.visit_expr(node.children[0]))
+
+    def visit_expr(self, node):
+        chnode = node.children[0]
+        if chnode.symbol == 'DECIMAL':
+            return ConstantInt(int(chnode.additional_info))
         xxx
 
 transformer = Transformer()

kermit/test/test_parser.py

                                                 ConstantInt(2)))])
     assert parse('1 + a;') == Block([Stmt(BinOp('+', ConstantInt(1),
                                                 Variable('a')))])
-    
+