-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.py
66 lines (51 loc) · 1.75 KB
/
shell.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from dreamscript import *
from parser import *
print("\nDip Version 0.1 - Beta\n")
print('\nType "help", "copyright", "credits" or "about" for more information.\n')
while True:
raw_text = input("Dip> ")
if raw_text.strip() == "": continue
if raw_text == "copyright":
print("Copyright (c) Raghav Nautiyal. All Rights Reserved.")
continue
if raw_text == "help":
print("Visit https://dip.org/docs for help!")
continue
if raw_text == "credits":
print("Thanks to Reddit, Youtube and other online sources for supporting Dip's development. See www.dip.org for more information.")
continue
if raw_text == "about":
print("""
Dip was created in 2020 by Raghav Nautiyal while he was a student in High School in India,
as a language similar to Python but aimed at beginners. (Hence the recursive name - Dip Isn't Python).
Raghav remains Dip's principal author, although it includes many contributions from others.
""")
continue
if raw_text == "exit":
print("Use exit() or Ctrl-C to exit")
continue
if raw_text == "exit()":
exit()
result, error = run('<stdin>', raw_text)
bear ="""
__,__
.--. .-" "-. .--.
/ .. \/ .-. .-. \/ .. \\
| | '| / Y \ |' | |
| \ \ \ 0 | 0 / / / |
\ '- ,\.-"`` ``"-./, -' /
`'-' /_ ^ ^ _\ '-'`
| \._ _./ |
\ \ `~` / /
'._ '-=-' _.'
'~---~'
"""
if error:
print(error.as_string())
print(bear)
elif result:
if len(result.elements) == 1:
print(repr(result.elements[0]))
else:
for i in result.elements:
print(repr(i))