-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompy.py
More file actions
28 lines (25 loc) · 1.03 KB
/
Compy.py
File metadata and controls
28 lines (25 loc) · 1.03 KB
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
import sys
import yacc as hola
sys.tracebacklimit = 0
from MaquinaVitual import MaquinaVirtual
if(len(sys.argv) < 3):
print("¡Bienvenido a Compy!. 🐬")
print("Recuerda que el comando para ejecutar es:")
print("Compy.py (Funcion:)Compilar o Ejecutar (Archivo:)Nombre.txt")
if(len(sys.argv) == 3):
if(str(sys.argv[1])== "Compilar" or str(sys.argv[1]) == "Ejecutar"):
try:
archivo = open(sys.argv[2],"r")
contenido = archivo.read()
archivo.close()
if(hola.parser.parse(contenido, tracking=True) == 'PROGRAM COMPILED'):
print("¡Compilacion Correcta! 😌")
if(str(sys.argv[1]) == "Ejecutar"):
print("¡Ejecutando! 🏃🏿💨👌🏿😫🔥💯\n")
MaquinaVirtual(hola.tabla,hola.quads)
else:
print("Errores en la compilacion. 🤯")
except EOFError:
print(EOFError)
else:
print("Funcion Incorrecta. Recuerda utilizar Compilar o Ejecutar. 😃")