Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ('for', start, cond, iter, block)
- class Node:
- def print(self, indent=0):
- raise NotImplementedError
- def eval(self, env):
- raise NotImplementedError
- from collections import namedtuple
- @namedtuple
- class For(Node):
- start: Node
- cond: Node
- iter: Node
- body: Node
- def print(self, indent=0):
- ...
- def check(self, env):
- pass
- def eval(self, env):
- self.start.eval(env)
- while self.cond.eval(env):
- self.body.eval(env)
- self.iter.eval(env)
- n = For(start, cond, iter, block)
- n.print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement