Resilient parsing!
This commit is contained in:
@@ -10,4 +10,12 @@ class Atom:
|
||||
self.car = atom
|
||||
|
||||
def append(self, atom: Atom):
|
||||
self.cdr = atom
|
||||
self.cdr = atom
|
||||
|
||||
def __str__(self):
|
||||
if type(self.car) is Atom:
|
||||
return "(" + self.car.__str__() + ("" if self.cdr is None else (" " + self.cdr.__str__())) + ")"
|
||||
elif self.car is None:
|
||||
return "()"
|
||||
else:
|
||||
return self.car + ("" if self.cdr is None else self.cdr.__str__())
|
||||
Reference in New Issue
Block a user