-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell.py
More file actions
44 lines (34 loc) · 959 Bytes
/
Copy pathshell.py
File metadata and controls
44 lines (34 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import lexer
from pyfiglet import Figlet
from parser_1 import Parser
from interpreter import Interpreter
RED = '\033[91m'
RESET = '\033[0m'
GREEN = '\033[92m'
f = Figlet(font='slant')
name = f.renderText('TengenScript')
print(name)
print("")
print(f">This project is just to Learn {RED}OOP{RESET}")
print("")
print(GREEN +"Why so serious!!" + RESET)
print("")
while True:
text=input("TengenScript >")
if not text:
continue
newLexer=lexer.Lexer("<Terminal>",text)
tokens,error=newLexer.make_tokens()
if error:
print(f"{RED} {error} {RESET}")
else:
print(tokens)
parsedRes=Parser(tokens).parse()
if not parsedRes:
print(f"{RED} Something Might be Wrong {RESET}")
continue
res=Interpreter().recursive_Calc(parsedRes)
if not res:
print(f"{RED} Something Might be Wrong {RESET}")
continue
print(res)