cclang/src/Interpreter/Interpreter.py

34 lines
946 B
Python
Raw Normal View History

from Interpreter.Validator import Validator
from Interpreter.Lexer import Lexer
2020-09-23 06:48:38 +02:00
# from Interpreter.Parser_Old import Parser
from Interpreter.Parser import Parser
from Interpreter.Repo import Repo
from Interpreter.Utils import Utils
class Interpreter:
def __init__(self, repo: Repo, utils: Utils) -> None:
self.__repo = repo
self.__utils = utils
self.__lexer = Lexer(repo, utils)
self.__parser = Parser(repo, utils)
self.__validator = Validator(repo, utils)
2020-09-17 19:33:52 +02:00
def interpret(self, line_str: str) -> None:
"""
Interprets code line
:param line_str:
:return:
"""
tokens = []
if self.__repo.is_error is None:
tokens = self.__lexer.tokenize(line_str)
if self.__repo.is_error is None:
self.__parser.parse(tokens)
# if self.__repo.is_error is None:
# self.__validator.validate(self.__repo.AST)