aboutsummaryrefslogtreecommitdiff
path: root/compilador/main.py
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-11-16 20:07:28 -0600
committerIván Ávalos <avalos@disroot.org>2022-11-16 20:07:28 -0600
commitb20e23d221ac418deb8fa495fa375f715511f953 (patch)
tree9731460f5f3b95128f33e1a5bebaf92eeeae9c33 /compilador/main.py
parente4cf758129e81cf3e400a1432ec2d6604fe67a2d (diff)
downloadjavanol-b20e23d221ac418deb8fa495fa375f715511f953.tar.gz
javanol-b20e23d221ac418deb8fa495fa375f715511f953.tar.bz2
javanol-b20e23d221ac418deb8fa495fa375f715511f953.zip
Se añade tabla de símbolos a la interfaz
Diffstat (limited to 'compilador/main.py')
-rw-r--r--compilador/main.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/compilador/main.py b/compilador/main.py
index c27c107..186ca83 100644
--- a/compilador/main.py
+++ b/compilador/main.py
@@ -6,14 +6,16 @@ from lexer import *
class Main:
input_file = None
output_file = None
+ output_table = False
def print_help (self, arg0):
- print("Uso: % s -i entrada.ñ -o salida.ñ" % arg0)
+ print("Uso: % s -i entrada.es -o salida.es" % arg0)
+ print(" % s -i entrada.es -o salida.es -t")
print(" % s -h" % arg0)
def main(self, argv):
try:
- opts, args = getopt.getopt(argv[1:], "hi:o:", ["input=", "output="])
+ opts, args = getopt.getopt(argv[1:], "hi:o:t", ["input=", "output=", "table"])
except getopt.GetoptError as err:
print(err)
print_help(argv[0]);
@@ -26,13 +28,18 @@ class Main:
self.input_file = a
elif o in ("-o", "--output"):
self.output_file = a
+ elif o in ("-t", "--table"):
+ self.output_table = True
else:
assert False, "opción desconocida"
if self.input_file and self.output_file:
with open(self.input_file) as f:
data = f.read()
- Lexer(data).inicio()
+ if self.output_table:
+ Lexer(data, self.input_file).inicio()
+ else:
+ Lexer(data, None).inicio()
if __name__ == "__main__":
Main().main(sys.argv)