-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (25 loc) · 898 Bytes
/
main.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
import sys
from src.top_down_parsing import top_down
from src.bottom_up_parsing import bottom_up
from src.grammar_generator import grammar_generator
def main(args):
if len(args) == 1:
if args[0] == '-td':
top_down()
elif args[0] == '-bu':
bottom_up()
elif args[0] == '-g':
grammar_generator()
else:
arg = input('Choose an option between Bottom-Up parsing (bu), Top-Down parsing (td) and Grammar generator (g): ')
while arg != 'td' and arg != 'bu' and arg != 'g':
arg = input('Please, choose a valid option between Bottom-Up parsing (bu) Top-Down parsing (td) and Grammar generator (g): ')
if arg == 'td':
top_down()
elif arg == 'bu':
bottom_up()
else:
grammar_generator()
if __name__ == '__main__':
args = sys.argv[1:]
main(args)