minor cleanup

This commit is contained in:
Simon Forman
2022-09-07 23:43:50 -07:00
parent e13a7b9f5c
commit ac326590db
3 changed files with 94 additions and 68 deletions
-28
View File
@@ -1,28 +0,0 @@
'''
Not this one!
Use the other file! derp
'''
class Expression:
def __init__(self, initial_expression=()):
self.current = initial_expression
self.stack = []
def __next__(self):
if self.current:
item, self.current = self.current
return item
if self.stack:
self.current = self.stack.pop()
return self.__next__()
raise StopIteration
def prepend(self, quoted_program):
if self.current:
self.stack.append(self.current)
self.current = quoted_program
from parser import text_to_expression as j
e = Expression(j('23 18'))