agtest/agtypeck.py

18 lines
429 B
Python

from typing import *
from agast import *
def typecheck(program: List[Decl]) -> None:
i = 0
def gen(name: str = "") -> str:
return f"__ag{i:03}{name}"
# collect a list of name -> iface declarations
ifaces: Dict[str, Decl] = dict(
map(lambda c: (c.name, c),
filter(lambda c: isinstance(c, Iface),
program)))
print(ifaces)
for node in filter(lambda c: isinstance(c, Node), program):
print(node)