Add semantics analyzer function to process file components
This commit is contained in:
parent
a340fe7936
commit
16a3446d48
16
compiler.py
16
compiler.py
|
@ -1977,6 +1977,22 @@ class Context:
|
||||||
raise KeyError
|
raise KeyError
|
||||||
|
|
||||||
|
|
||||||
|
def semantics_analyzer(file: File) -> Context:
|
||||||
|
screen: Screen | None = None
|
||||||
|
constraints: dict[str, int | float] = {}
|
||||||
|
animations: dict[str, ContextAnimation] = {}
|
||||||
|
graphs: list[ContextGraph] = []
|
||||||
|
for child in file.children:
|
||||||
|
if isinstance(child, Screen):
|
||||||
|
pass
|
||||||
|
elif isinstance(child, Constant):
|
||||||
|
pass
|
||||||
|
elif isinstance(child, Animation):
|
||||||
|
pass
|
||||||
|
elif isinstance(child, Graph):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
with open("example.graph", encoding='utf-8') as file:
|
with open("example.graph", encoding='utf-8') as file:
|
||||||
|
|
Loading…
Reference in New Issue