Kaydet (Commit) b1c15743 authored tarafından Batuhan Taşkaya's avatar Batuhan Taşkaya

Representations

üst 382d74ba
......@@ -17,19 +17,26 @@ class Node:
def add_child(self, child):
self.children.append(child)
def __str__(self):
level = 0
for child in self.children:
print(child)
@dataclass
class KVNode:
lhs: Any
rhs: Any
def __str__(self):
return f"\n{self.lhs} => {self.rhs} | "
@dataclass
class LinkedNode:
prev: Optional[LinkedNode]
value: Any
def __str__(self):
return f"{value} ->"
return f"\n{self.value} ->"
class Viz:
typeregs = {}
......@@ -87,3 +94,4 @@ node = viz.visit({
(1, 2): 'a'
})
print(node)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment