parrot/main.py

21 lines
425 B
Python
Raw Normal View History

2023-04-06 03:17:57 +01:00
from lexer import Lexer
from parser import Parser
2023-04-10 03:20:05 +01:00
from evaluator import Evaluator
2023-04-06 03:17:57 +01:00
def main() -> None:
2023-04-10 03:20:05 +01:00
text = "\"hello\""
2023-04-06 03:17:57 +01:00
lexer = Lexer(text)
parser = Parser(text, lexer)
2023-04-10 03:20:05 +01:00
print("parsing...")
2023-04-09 02:48:26 +01:00
parsed = parser.parse()
2023-04-10 03:20:05 +01:00
print("ast = ")
2023-04-09 02:48:26 +01:00
for node in parsed:
print(node)
2023-04-10 03:20:05 +01:00
evaluator = Evaluator()
print("evaluating...")
evaluator.evaluate(parsed)
2023-04-06 03:17:57 +01:00
if __name__ == "__main__":
main()