forked from samuellimabraz/EmojiCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (23 loc) · 816 Bytes
/
main.py
File metadata and controls
31 lines (23 loc) · 816 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
import sys
from src.emoji_parser import EmojiParser
from src.gcc_translate import Translator
def main():
parser = EmojiParser()
translator = Translator()
codigo: str = ""
output: str = "output"
if len(sys.argv) >= 2:
with open(sys.argv[1], "r") as file:
codigo = file.read()
if len(sys.argv) == 3:
output = sys.argv[2]
else:
print("Usage python main.py <file.emo> [<output_name>]")
print("/" + 10 * "-" + "Analise Lexica" + 10 * "-" + "/\n")
parser.lexer.test(codigo)
print("/" + 10 * "-" + "Analise Sintatica" + 10 * "-" + "/\n")
r = parser.parse(codigo, True)
print("/" + 10 * "-" + "Tradução" + 10 * "-" + "/\n")
translator.translate(codigo, name=output, execute=True)
if __name__ == "__main__":
main()