def get_AST_from_raw(raw: str) -> AST: ''' Get an AST from raw text Parameters ---------- raw : str raw text Returns ------- An unparsed AST object Raises ------ PyllowException if something like a syntax error is present in `raw` ''' return AST(get_tokens_from_raw(raw))
def setUp(self): self.tree = AST(())
from pprint import pprint from src.AST import AST from src.Lexer import Lexer lexer = Lexer() lexer.lex_file('test/binaryexpr.plw') pprint(lexer.tokens) tree = AST(lexer.tokens) if not tree.parse(): # exit() pass print('-' * 100) #pprint(tree.tree.pprint_list(), indent=4) print('-' * 100) tree.execute() pprint(tree.tree._scope) print('-' * 100) pass