-
Notifications
You must be signed in to change notification settings - Fork 0
/
View.py
97 lines (74 loc) · 2.29 KB
/
View.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"""
LYM - Project 0 by Julian Mondragon and Ana Hernandez
"""
import Parce as parser
def main():
print("")
print("WELCOME to the syntax checker of the robot program.")
print("")
print("To check your program make sure to follow these instructions: ")
print("")
print("-- *CONDITIONALS AND LOOPS*--")
print("Write ¨if-else¨, ¨repeat x times¨ and ¨while¨ instructions in just one code line.")
print("")
print("-- *DEFPROC* --")
print("When adding a defproc, write one brace per line. Then, write the instructions block between both braces. Instructions must be written in just one code line. Here is an example: ")
print("")
print("Example: ")
print("defProc goNorth()")
print("{while can(walk(1,north)){walk(1,north)}}")
print("")
print("-- *CODE BLOCKS* --")
print("If you have block of instructions you must write them in one code line.")
print("For instance check: ")
print("{jump (3 ,3) ; putCB (2 ,1)}")
print("")
print("ALSO")
print("Do not press 'enter' between code lines.")
print("")
print("WARNING!")
print("Otherwise the verification process will fail")
print("")
print("Enjoy! :)")
print(r"""
/\_/\
( o.o )
> ^ <
""")
print("This is Project 0 by Ana Maria Hernandez and Julian Mondragon")
file = input("Insert the path of the file you want to read: ")
answer = parser.check_all(file)
print("")
if answer:
print("The syntax of the program is correct!")
print(r"""
(___)
/\___/\
/ \
l u u l
--l----*----l--
\ w / - GOOD JOB!
======
/ \ __
l l\ \
l l/ /
l l l l /
\ ml lm /_/
""")
else:
print("The syntax of the program is incorrect")
print(r"""
/ )
TRY AGAIN
/ /
/ / /\
/ / .-```-. / ^`-.
\ \ / \_/ (|) `o
\ \ / .-. \\ _ ,--'
\ \/ / ) \( `^^^
\ \/ ( )
\ ) ) /
) /__ | (__
(___))) (__)))
""")
main()