Resilient parsing!

This commit is contained in:
etc404
2026-04-26 20:50:40 -06:00
parent 7d6b339cc6
commit 00d1ff11d7
4 changed files with 43 additions and 27 deletions
+9 -1
View File
@@ -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__())