def plus_minus(Token_arry): lexT = Token_arry[0] Token_arry = Token_arry[1:-1] plus_minus() while(lexT is '+' or lexT is '-'): lex() multi_div() multi_div()
def multi_div(Token_arry): lexT = Token_arry[0] Token_arry = Token_arry[1:-1] multi_div() while(lexT is '*' or lexT is '/'): lex() parens() parens()
def truth(Token_arry): lexT = Token_arry[0] Token_arry = Token_arry[1:-1] if(lexT is 'Tru'): lex() elif(lexT is 'False'): lex() else: error()
def main(): test = open('test.txt', 'r').read() Token_arry = lex().tokenize(test) while True: Token_arry = statement(Token_arry) if len(Token_arry) == 0: break
def logic(Token_arry): lexT = Token_arry[0] Token_arry = Token_arry[1:-1] if(lexT is 'and'): lex() elif(lexT is 'or'): lex() elif(lexT is 'nah'): lex() else: error()