From 3fc7562e98fe890731c4442e9bbf6934bcb3c74e Mon Sep 17 00:00:00 2001 From: "Juan M. Ley" Date: Thu, 7 May 2026 18:01:06 -0600 Subject: [PATCH] PRIMER COMMIT --- .gitignore | 1 + README.txt | 161 ++ demo.zap | 54 + interprete.py | 555 +++++ requirements.txt | 1 + zaplangLexer.g4 | 406 ++++ zaplangLexer.interp | 270 +++ zaplangLexer.py | 405 ++++ zaplangLexer.tokens | 146 ++ zaplangParser.g4 | 308 +++ zaplangParser.interp | 216 ++ zaplangParser.py | 4523 ++++++++++++++++++++++++++++++++++++++ zaplangParser.tokens | 146 ++ zaplangParserListener.py | 453 ++++ zaplangParserVisitor.py | 258 +++ 15 files changed, 7903 insertions(+) create mode 100644 .gitignore create mode 100644 README.txt create mode 100644 demo.zap create mode 100644 interprete.py create mode 100644 requirements.txt create mode 100644 zaplangLexer.g4 create mode 100644 zaplangLexer.interp create mode 100644 zaplangLexer.py create mode 100644 zaplangLexer.tokens create mode 100644 zaplangParser.g4 create mode 100644 zaplangParser.interp create mode 100644 zaplangParser.py create mode 100644 zaplangParser.tokens create mode 100644 zaplangParserListener.py create mode 100644 zaplangParserVisitor.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..2d30c6c --- /dev/null +++ b/README.txt @@ -0,0 +1,161 @@ +================================================================================ + ZAPLANG + Lenguaje de programación con sintaxis en español +================================================================================ + +DESCRIPCIÓN +----------- +zaplang es un lenguaje de programación interpretado cuya sintaxis está inspirada +en C pero con palabras clave completamente en español. Está construido con ANTLR4 +(gramática dividida en Lexer y Parser) y un intérprete escrito en Python que +ejecuta el árbol de análisis mediante el patrón Visitor. + +El objetivo es facilitar el aprendizaje de programación a hispanohablantes, +eliminando la barrera del inglés en las palabras reservadas del lenguaje. + + +ARCHIVOS DEL PROYECTO +--------------------- + zaplangLexer.g4 Gramática del analizador léxico (ANTLR4) + zaplangParser.g4 Gramática del analizador sintáctico (ANTLR4) + zaplangLexer.py Código generado por ANTLR4 (lexer) + zaplangParser.py Código generado por ANTLR4 (parser) + zaplangParserListener.py Listener generado por ANTLR4 + zaplangParserVisitor.py Visitor generado por ANTLR4 + zaplangLexer.tokens Tabla de tokens del lexer + zaplangParser.tokens Tabla de tokens del parser + zaplangLexer.interp Archivo de interpretación del lexer + zaplangParser.interp Archivo de interpretación del parser + interprete.py Intérprete principal (ejecuta programas .zap) + demo.zap Programa de demostración + + +REQUISITOS +---------- + - Python 3.8 o superior + - ANTLR4 runtime para Python: + + pip install antlr4-python3-runtime + + (Nota: no es necesario regenerar los archivos .py desde las gramáticas a menos + que se modifiquen los archivos .g4) + + +CÓMO EJECUTAR UN PROGRAMA +-------------------------- + python interprete.py + +Ejemplo con el programa de demostración incluido: + + python interprete.py demo.zap + +Salida esperada: + + === Demo zaplang === + Cuadrados: 1 4 9 16 25 + x es mayor que 10 + Factorial de 6: 720 + Arreglo: 10 20 30 40 50 + Cuenta regresiva: 3 2 1 ¡Ya! + ¡Hola desde zaplang! + + +PALABRAS RESERVADAS +------------------- + Tipos de datos: + Ent → entero (int) + doble → doble precisión (double) + flot → flotante (float) + carac → carácter (char) + cf → con firma (signed) + sf → sin firma (unsigned) + vacio → sin retorno (void) + + Control de flujo: + si → if + sino → else + mientras → while + por → for + caso → case / switch + pordef → default + retornar → return + fin → break + interrup → continue + + Estructuras: + estruct → struct + enum → enum + + Literales booleanos: + verdadero → true + falso → false + + Especial: + bul → marca de punto de entrada en estructuras caso/switch + + +FUNCIONES DE ENTRADA/SALIDA INTEGRADAS +--------------------------------------- + imprimir(valor) Imprime un valor sin salto de línea + imprimirln(valor) Imprime un valor con salto de línea + leer() Lee una línea como cadena de texto + leerEnt() Lee un número entero desde la entrada estándar + leerFlot() Lee un número flotante desde la entrada estándar + leerCarac() Lee un carácter desde la entrada estándar + longitud(cadena) Devuelve la longitud de una cadena + + +CARACTERÍSTICAS DEL LENGUAJE +----------------------------- + - Funciones con parámetros y valor de retorno + - Variables locales y globales con scoping léxico + - Arreglos de tamaño fijo con inicialización literal + - Estructuras (estruct) y enumeraciones (enum) + - Punteros (sintaxis soportada, comportamiento simplificado) + - Operadores aritméticos, lógicos, relacionales y de bits + - Operadores de asignación compuesta (+=, -=, *=, etc.) + - Operadores de incremento/decremento prefijos y postfijos (++/--) + - Sentencia condicional (si/sino) + - Estructura tipo switch (caso bul) + - Bucles mientras y por (while y for) + - Expresión ternaria (condicion ? valor_si : valor_no) + - Comentarios de línea (//) y de bloque (/* */) + - Punto de entrada obligatorio: función main() + + +EJEMPLO DE PROGRAMA +------------------- + Ent factorial(Ent n) { + si (n <= 1) retornar 1; + retornar n * factorial(n - 1); + } + + vacio main() { + Ent resultado = factorial(6); + imprimirln(resultado); // Imprime: 720 + } + + +REGENERAR LOS ARCHIVOS DE ANTLR4 (OPCIONAL) +-------------------------------------------- +Si se modifican las gramáticas (.g4), regenerar con: + + antlr4 -Dlanguage=Python3 zaplangLexer.g4 + antlr4 -Dlanguage=Python3 zaplangParser.g4 + +Requiere tener instalado ANTLR4 (herramienta de línea de comandos). +Descarga: https://www.antlr.org/ + + +ARQUITECTURA INTERNA +-------------------- + 1. El código fuente (.zap) se lee como texto plano. + 2. zaplangLexer tokeniza el flujo de caracteres. + 3. zaplangParser construye el árbol de análisis sintáctico (AST). + 4. El intérprete (interprete.py) recorre el AST usando el patrón Visitor, + administrando un entorno de variables con scoping por cadena de entornos + (clase Entorno con referencia al padre). + 5. El control de flujo (retornar, fin, interrup) se implementa mediante + excepciones de Python (RetornarSenal, FinSenal, InterrupSenal). + +================================================================================ diff --git a/demo.zap b/demo.zap new file mode 100644 index 0000000..8d0fa7b --- /dev/null +++ b/demo.zap @@ -0,0 +1,54 @@ +// Demo zaplang — declaraciones antes de sentencias en cada bloque + +Ent factorial(Ent n) { + si (n <= 1) retornar 1; + retornar n * factorial(n - 1); +} + +vacio saludar() { + imprimirln("¡Hola desde zaplang!"); +} + +vacio main() { + Ent cuenta; + Ent nums[5] = {10, 20, 30, 40, 50}; + + imprimirln("=== Demo zaplang ==="); + + imprimir("Cuadrados: "); + Ent i = 1; + por (; i <= 5; i++) { + imprimir(i * i); + imprimir(" "); + } + imprimirln(""); + + Ent x = 42; + si (x > 10) { + imprimirln("x es mayor que 10"); + } sino { + imprimirln("x es menor o igual a 10"); + } + + imprimir("Factorial de 6: "); + imprimirln(factorial(6)); + + imprimir("Arreglo: "); + i = 0; + por (; i < 5; i++) { + imprimir(nums[i]); + imprimir(" "); + } + imprimirln(""); + + cuenta = 3; + imprimir("Cuenta regresiva: "); + mientras (cuenta > 0) { + imprimir(cuenta); + imprimir(" "); + cuenta--; + } + imprimirln("¡Ya!"); + + saludar(); +} diff --git a/interprete.py b/interprete.py new file mode 100644 index 0000000..9b60126 --- /dev/null +++ b/interprete.py @@ -0,0 +1,555 @@ +""" +Intérprete de zaplang usando ANTLR4 (visitor pattern). +Incluye funciones IO integradas: imprimir, imprimirln, leer, leerEnt, leerFlot. +""" + +import sys +import math +from antlr4 import * +from antlr4.error.ErrorListener import ErrorListener + +from zaplangLexer import zaplangLexer +from zaplangParser import zaplangParser + + +# ───────────────────────────────────────────── +# Señales de control de flujo +# ───────────────────────────────────────────── +class RetornarSenal(Exception): + def __init__(self, valor): self.valor = valor + +class FinSenal(Exception): pass # break +class InterrupSenal(Exception): pass # continue + + +# ───────────────────────────────────────────── +# Entorno (scoping) +# ───────────────────────────────────────────── +class Entorno: + def __init__(self, padre=None): + self.vars = {} + self.padre = padre + + def definir(self, nombre, valor): + self.vars[nombre] = valor + + def obtener(self, nombre): + if nombre in self.vars: + return self.vars[nombre] + if self.padre: + return self.padre.obtener(nombre) + raise NameError(f"Variable no definida: '{nombre}'") + + def asignar(self, nombre, valor): + if nombre in self.vars: + self.vars[nombre] = valor + return + if self.padre: + self.padre.asignar(nombre, valor) + return + raise NameError(f"Variable no definida: '{nombre}'") + + +# ───────────────────────────────────────────── +# Funciones IO integradas +# ───────────────────────────────────────────── +def _procesar_cadena(s): + """Interpreta secuencias de escape en cadenas.""" + return s.encode('raw_unicode_escape').decode('unicode_escape') + +FUNCIONES_IO = { + # imprimir(val, ...) → imprime sin salto de línea + "imprimir": lambda args: print(*[_fmt(a) for a in args], end=""), + # imprimirln(val, ...) → imprime con salto de línea + "imprimirln": lambda args: print(*[_fmt(a) for a in args]), + # leer() → lee una línea como cadena + "leer": lambda args: input(), + # leerEnt() → lee un entero + "leerEnt": lambda args: int(input()), + # leerFlot() → lee un flotante + "leerFlot": lambda args: float(input()), + # leerCarac() → lee un carácter + "leerCarac": lambda args: input()[0] if input() else '\0', + # longitud(s) → len de cadena + "longitud": lambda args: len(str(args[0])), +} + +def _fmt(v): + if isinstance(v, bool): return "verdadero" if v else "falso" + if isinstance(v, float) and v == int(v): return str(int(v)) + return str(v) + + +# ───────────────────────────────────────────── +# Visitor / Intérprete +# ───────────────────────────────────────────── +class Interprete: + def __init__(self): + self.global_env = Entorno() + self.funciones = {} # nombre → ctx de declaracionFuncion + self._registrar_io() + + def _registrar_io(self): + """Registra las funciones IO como callables nativos.""" + for nombre, fn in FUNCIONES_IO.items(): + self.funciones[nombre] = fn # callable nativo + + # ── Entrada principal ────────────────────────────────────── + def ejecutar(self, arbol): + self.visitar_unidad(arbol, self.global_env) + + def visitar_unidad(self, ctx, env): + for decl in ctx.declaracionExterna(): + self.visitar_declaracion_externa(decl, env) + # Buscar y ejecutar main + if "main" not in self.funciones: + raise RuntimeError("No se encontró la función 'main'") + self.llamar_funcion("main", [], env) + + def visitar_declaracion_externa(self, ctx, env): + if ctx.declaracionFuncion(): + self.registrar_funcion(ctx.declaracionFuncion()) + elif ctx.declaracionVariable(): + self.visitar_decl_variable(ctx.declaracionVariable(), env) + elif ctx.declaracionEstruct(): + pass # extensible + elif ctx.declaracionEnum(): + self.visitar_decl_enum(ctx.declaracionEnum(), env) + + # ── Funciones ────────────────────────────────────────────── + def registrar_funcion(self, ctx): + nombre = ctx.identificadorFuncion().Identificador().getText() + self.funciones[nombre] = ctx + + def llamar_funcion(self, nombre, args, env): + fn = self.funciones.get(nombre) + if fn is None: + raise RuntimeError(f"Función no definida: '{nombre}'") + # Nativa (IO) + if callable(fn) and not hasattr(fn, 'listaParametros'): + return fn(args) + # Definida en zaplang + local = Entorno(self.global_env) + params = fn.listaParametros() + if params: + param_list = params.declaracionParametro() + for i, param in enumerate(param_list): + pnombre = param.Identificador().getText() + valor = args[i] if i < len(args) else None + local.definir(pnombre, valor) + try: + self.visitar_bloque(fn.bloque(), local) + except RetornarSenal as r: + return r.valor + return None + + # ── Bloque y sentencias ──────────────────────────────────── + def visitar_bloque(self, ctx, env): + if ctx.LlaveIzq(): + for dv in ctx.declaracionVariable(): + self.visitar_decl_variable(dv, env) + for sent in ctx.sentencia(): + self.visitar_sentencia(sent, env) + else: + self.visitar_sentencia(ctx.sentencia(), env) + + def visitar_sentencia(self, ctx, env): + if ctx.sentenciaCompuesta(): + inner = Entorno(env) + for s in ctx.sentenciaCompuesta().sentencia(): + self.visitar_sentencia(s, inner) + elif ctx.sentenciaDeclaracion(): + self.visitar_decl_variable(ctx.sentenciaDeclaracion().declaracionVariable(), env) + elif ctx.sentenciaExpresion(): + se = ctx.sentenciaExpresion() + if se.expresion(): + self.visitar_expresion(se.expresion(), env) + elif ctx.sentenciaSeleccion(): + self.visitar_seleccion(ctx.sentenciaSeleccion(), env) + elif ctx.sentenciaIteracion(): + self.visitar_iteracion(ctx.sentenciaIteracion(), env) + elif ctx.sentenciaSalto(): + self.visitar_salto(ctx.sentenciaSalto(), env) + + # ── Declaración de variables ─────────────────────────────── + def visitar_decl_variable(self, ctx, env): + for init_var in ctx.inicializadorVariable(): + nombre = init_var.Identificador().getText() + if init_var.inicializadorArreglo(): + items = [] + la = init_var.inicializadorArreglo().listaInitializers() + if la: + for ae in la.asignacionExpresion(): + items.append(self.visitar_asignacion(ae, env)) + env.definir(nombre, items) + elif init_var.inicializador(): + val = self.visitar_asignacion( + init_var.inicializador().asignacionExpresion(), env) + env.definir(nombre, val) + elif init_var.ConstanteEntera(): + tamaño = int(init_var.ConstanteEntera().getText()) + env.definir(nombre, [None] * tamaño) + else: + env.definir(nombre, None) + + # ── Enum ─────────────────────────────────────────────────── + def visitar_decl_enum(self, ctx, env): + contador = 0 + for en in ctx.listaEnumeradores().enumerador(): + nombre = en.Identificador().getText() + if en.ConstanteEntera(): + contador = int(en.ConstanteEntera().getText()) + env.definir(nombre, contador) + self.global_env.definir(nombre, contador) + contador += 1 + + # ── Selección ────────────────────────────────────────────── + def visitar_seleccion(self, ctx, env): + if ctx.Si(): + cond = self.visitar_expresion(ctx.expresion(), env) + sentencias = ctx.sentencia() + if cond: + self.visitar_sentencia(sentencias[0], Entorno(env)) + elif len(sentencias) > 1: + self.visitar_sentencia(sentencias[1], Entorno(env)) + elif ctx.Caso(): + # switch-like: caso bul { caso X: ... pordef: ... } + val_bul = self.visitar_expresion(ctx.expresion(), env) if ctx.expresion() else None + ejecutando = False + for etiqueta in ctx.casoEtiqueta(): + val = self.visitar_constante(etiqueta.constanteExpresion(), env) + if val == val_bul or ejecutando: + ejecutando = True + try: + for s in etiqueta.sentencia(): + self.visitar_sentencia(s, env) + except FinSenal: + return + if ctx.etiquetaPorDef() and ejecutando is False: + try: + for s in ctx.etiquetaPorDef().sentencia(): + self.visitar_sentencia(s, env) + except FinSenal: + pass + + # ── Iteración ────────────────────────────────────────────── + def visitar_iteracion(self, ctx, env): + if ctx.Mientras(): + while self.visitar_expresion(ctx.expresion()[0], env): + try: + self.visitar_sentencia(ctx.sentencia(), Entorno(env)) + except FinSenal: + break + except InterrupSenal: + continue + elif ctx.Por(): + # Gramática: Por ( sentenciaExpresion? ; expresion? ; expresion? ) sentencia + # sentenciaExpresion ya tiene su propio ';', luego viene ';' cond ';' paso + loop_env = Entorno(env) + # init: sentenciaExpresion opcional (tiene su ';') + se = ctx.sentenciaExpresion() + if se and se.expresion(): + self.visitar_expresion(se.expresion(), loop_env) + # cond y paso: expresion(0) y expresion(1) — pueden ser None + exprs = ctx.expresion() + cond_expr = exprs[0] if len(exprs) > 0 else None + paso_expr = exprs[1] if len(exprs) > 1 else None + while True: + if cond_expr is not None and not self.visitar_expresion(cond_expr, loop_env): + break + try: + self.visitar_sentencia(ctx.sentencia(), Entorno(loop_env)) + except FinSenal: + break + except InterrupSenal: + pass + if paso_expr: + self.visitar_expresion(paso_expr, loop_env) + + # ── Salto ───────────────────────────────────────────────── + def visitar_salto(self, ctx, env): + if ctx.Retornar(): + val = self.visitar_expresion(ctx.expresion(), env) if ctx.expresion() else None + raise RetornarSenal(val) + elif ctx.Fin(): + raise FinSenal() + elif ctx.Interrup(): + raise InterrupSenal() + + # ── Expresiones ──────────────────────────────────────────── + def visitar_expresion(self, ctx, env): + # expresion: asignacionExpresion | expresion Coma asignacionExpresion + # En el árbol: puede haber asignacionExpresion() como hijo único o múltiples + if hasattr(ctx, 'asignacionExpresion') and ctx.asignacionExpresion() is not None: + ae = ctx.asignacionExpresion() + val = self.visitar_asignacion(ae, env) + # Si hay expresion hija (caso con coma), procesarla primero + if ctx.expresion(): + val = self.visitar_expresion(ctx.expresion(), env) + val = self.visitar_asignacion(ae, env) + return val + return None + + def visitar_asignacion(self, ctx, env): + if ctx.expresionCondicional(): + return self.visitar_condicional(ctx.expresionCondicional(), env) + # Asignación + lhs = ctx.expresionUnaria() + op = ctx.operadorAsignacion().getText() + rhs = self.visitar_asignacion(ctx.asignacionExpresion(), env) + nombre, idx = self._resolver_lvalue(lhs, env) + if idx is not None: + arr = env.obtener(nombre) + viejo = arr[idx] + arr[idx] = self._aplicar_op_asign(op, viejo, rhs) + else: + viejo = None + try: viejo = env.obtener(nombre) + except: pass + env.asignar(nombre, self._aplicar_op_asign(op, viejo, rhs)) + return rhs + + def _aplicar_op_asign(self, op, viejo, nuevo): + if op == '=': return nuevo + if op == '+=': return (viejo or 0) + nuevo + if op == '-=': return (viejo or 0) - nuevo + if op == '*=': return (viejo or 0) * nuevo + if op == '/=': return (viejo or 0) / nuevo + if op == '%=': return (viejo or 0) % nuevo + if op == '&=': return int(viejo or 0) & int(nuevo) + if op == '|=': return int(viejo or 0) | int(nuevo) + if op == '^=': return int(viejo or 0) ^ int(nuevo) + if op == '<<=': return int(viejo or 0) << int(nuevo) + if op == '>>=': return int(viejo or 0) >> int(nuevo) + return nuevo + + def _resolver_lvalue(self, ctx_unaria, env): + """Devuelve (nombre, índice_o_None).""" + pf = ctx_unaria.expresionPostfija() + if pf and pf.expresionPostfija() and pf.CorcheteIzq(): + nombre = pf.expresionPostfija().expresionPrimaria().Identificador().getText() + idx = int(self.visitar_expresion(pf.expresion(), env)) + return nombre, idx + elif pf and pf.expresionPrimaria() and pf.expresionPrimaria().Identificador(): + return pf.expresionPrimaria().Identificador().getText(), None + return None, None + + def visitar_condicional(self, ctx, env): + val = self.visitar_logica_o(ctx.expresionLogicaO(), env) + if ctx.Pregunta(): + if val: + return self.visitar_expresion(ctx.expresion(), env) + else: + return self.visitar_condicional(ctx.expresionCondicional(), env) + return val + + def visitar_logica_o(self, ctx, env): + items = ctx.expresionLogicaY() + val = self.visitar_logica_y(items[0], env) + for i in range(1, len(items)): + if val: return True + val = self.visitar_logica_y(items[i], env) + if len(items) == 1: + return val # no convertir a bool si es expresión simple + return bool(val) + + def visitar_logica_y(self, ctx, env): + items = ctx.expresionIgualacion() + val = self.visitar_igualacion(items[0], env) + for i in range(1, len(items)): + if not val: return False + val = self.visitar_igualacion(items[i], env) + if len(items) == 1: + return val + return bool(val) + + def visitar_igualacion(self, ctx, env): + val = self.visitar_relacional(ctx.expresionRelacional(0), env) + ops = [t.getText() for t in ctx.getChildren() + if hasattr(t, 'getText') and t.getText() in ('==', '!=')] + for i, op in enumerate(ops): + r = self.visitar_relacional(ctx.expresionRelacional(i + 1), env) + val = (val == r) if op == '==' else (val != r) + return val + + def visitar_relacional(self, ctx, env): + val = self.visitar_desplaz(ctx.expresionDesplazamiento(0), env) + ops = [t.getText() for t in ctx.getChildren() + if hasattr(t, 'getText') and t.getText() in ('<', '>', '<=', '>=')] + for i, op in enumerate(ops): + r = self.visitar_desplaz(ctx.expresionDesplazamiento(i + 1), env) + if op == '<': val = val < r + elif op == '>': val = val > r + elif op == '<=': val = val <= r + elif op == '>=': val = val >= r + return val + + def visitar_desplaz(self, ctx, env): + val = self.visitar_aditiva(ctx.expresionAditiva(0), env) + ops = [t.getText() for t in ctx.getChildren() + if hasattr(t, 'getText') and t.getText() in ('<<', '>>')] + for i, op in enumerate(ops): + r = self.visitar_aditiva(ctx.expresionAditiva(i + 1), env) + val = (int(val) << int(r)) if op == '<<' else (int(val) >> int(r)) + return val + + def visitar_aditiva(self, ctx, env): + val = self.visitar_mult(ctx.expresionMultiplicativa(0), env) + ops = [t.getText() for t in ctx.getChildren() + if hasattr(t, 'getText') and t.getText() in ('+', '-')] + for i, op in enumerate(ops): + r = self.visitar_mult(ctx.expresionMultiplicativa(i + 1), env) + val = val + r if op == '+' else val - r + return val + + def visitar_mult(self, ctx, env): + val = self.visitar_unaria(ctx.expresionUnaria(0), env) + ops = [t.getText() for t in ctx.getChildren() + if hasattr(t, 'getText') and t.getText() in ('*', '/', '%')] + for i, op in enumerate(ops): + r = self.visitar_unaria(ctx.expresionUnaria(i + 1), env) + if op == '*': val = val * r + elif op == '/': + val = val // r if isinstance(val, int) and isinstance(r, int) else val / r + elif op == '%': val = val % r + return val + + def visitar_unaria(self, ctx, env): + if ctx.operadorUnario(): + op = ctx.operadorUnario().getText() + inner = ctx.expresionUnaria() + if op == '-': return -self.visitar_unaria(inner, env) + if op == '+': return +self.visitar_unaria(inner, env) + if op == '!': return not self.visitar_unaria(inner, env) + if op == '~': return ~int(self.visitar_unaria(inner, env)) + if op == '++': + nombre, idx = self._resolver_lvalue(inner, env) + v = self._get_lvalue(nombre, idx, env) + 1 + self._set_lvalue(nombre, idx, v, env) + return v + if op == '--': + nombre, idx = self._resolver_lvalue(inner, env) + v = self._get_lvalue(nombre, idx, env) - 1 + self._set_lvalue(nombre, idx, v, env) + return v + if op == '&': return self.visitar_unaria(inner, env) # simplificado + if op == '*': return self.visitar_unaria(inner, env) # simplificado + return self.visitar_postfija(ctx.expresionPostfija(), env) + + def _get_lvalue(self, nombre, idx, env): + v = env.obtener(nombre) + return v[idx] if idx is not None else v + + def _set_lvalue(self, nombre, idx, val, env): + if idx is not None: + env.obtener(nombre)[idx] = val + else: + env.asignar(nombre, val) + + def visitar_postfija(self, ctx, env): + # Llamada a función + if ctx.expresionPostfija() and ctx.ParenIzq(): + nombre_fn = ctx.expresionPostfija().expresionPrimaria().Identificador().getText() + args = [] + if ctx.listaArgumentos(): + for ae in ctx.listaArgumentos().asignacionExpresion(): + args.append(self.visitar_asignacion(ae, env)) + return self.llamar_funcion(nombre_fn, args, env) + # Índice arreglo + if ctx.expresionPostfija() and ctx.CorcheteIzq(): + arr = self.visitar_postfija(ctx.expresionPostfija(), env) + idx = int(self.visitar_expresion(ctx.expresion(), env)) + return arr[idx] + # Acceso miembro + if ctx.expresionPostfija() and ctx.Punto(): + obj = self.visitar_postfija(ctx.expresionPostfija(), env) + campo = ctx.Identificador().getText() + return obj.get(campo) + # Postfix ++/-- + if ctx.expresionPostfija() and ctx.MasMas(): + nombre, idx = self._resolver_lvalue_pf(ctx.expresionPostfija(), env) + v = self._get_lvalue(nombre, idx, env) + self._set_lvalue(nombre, idx, v + 1, env) + return v + if ctx.expresionPostfija() and ctx.MenosMenos(): + nombre, idx = self._resolver_lvalue_pf(ctx.expresionPostfija(), env) + v = self._get_lvalue(nombre, idx, env) + self._set_lvalue(nombre, idx, v - 1, env) + return v + return self.visitar_primaria(ctx.expresionPrimaria(), env) + + def _resolver_lvalue_pf(self, ctx_pf, env): + if ctx_pf.expresionPrimaria() and ctx_pf.expresionPrimaria().Identificador(): + return ctx_pf.expresionPrimaria().Identificador().getText(), None + return None, None + + def visitar_primaria(self, ctx, env): + if ctx.Identificador(): + return env.obtener(ctx.Identificador().getText()) + if ctx.constanteExpresion(): + return self.visitar_constante(ctx.constanteExpresion(), env) + if ctx.CadenaLiteral(): + raw = ctx.CadenaLiteral().getText()[1:-1] # quitar comillas + return raw.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r') + if ctx.expresion(): + return self.visitar_expresion(ctx.expresion(), env) + return None + + def visitar_constante(self, ctx, env): + if ctx.ConstanteEntera(): + txt = ctx.ConstanteEntera().getText() + return int(txt, 0) + if ctx.ConstanteFlotante(): + return float(ctx.ConstanteFlotante().getText()) + if ctx.ConstanteCaracteres(): + c = ctx.ConstanteCaracteres().getText()[1:-1] + return ord(c.encode('raw_unicode_escape').decode('unicode_escape')) + if ctx.Verdadero(): + return True + if ctx.Falso(): + return False + return None + + +# ───────────────────────────────────────────── +# Error listener +# ───────────────────────────────────────────── +class ErrorZap(ErrorListener): + def syntaxError(self, recognizer, offendingSymbol, line, col, msg, e): + raise SyntaxError(f"[Línea {line}:{col}] {msg}") + + +# ───────────────────────────────────────────── +# Punto de entrada +# ───────────────────────────────────────────── +def ejecutar_archivo(ruta): + with open(ruta, 'r', encoding='utf-8') as f: + codigo = f.read() + + flujo = InputStream(codigo) + lexer = zaplangLexer(flujo) + lexer.removeErrorListeners() + lexer.addErrorListener(ErrorZap()) + + tokens = CommonTokenStream(lexer) + parser = zaplangParser(tokens) + parser.removeErrorListeners() + parser.addErrorListener(ErrorZap()) + + arbol = parser.unidadTraduccion() + interprete = Interprete() + interprete.ejecutar(arbol) + + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Uso: python interprete.py ") + sys.exit(1) + try: + ejecutar_archivo(sys.argv[1]) + except SyntaxError as e: + print(f"Error de sintaxis: {e}", file=sys.stderr) + sys.exit(1) + except Exception as e: + print(f"Error: {e}", file=sys.stderr) + sys.exit(1) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3dee19f --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +antlr4 diff --git a/zaplangLexer.g4 b/zaplangLexer.g4 new file mode 100644 index 0000000..ea1f2a1 --- /dev/null +++ b/zaplangLexer.g4 @@ -0,0 +1,406 @@ +lexer grammar zaplangLexer; + +Bul + : 'bul' + ; + +Func + : 'func' + ; + +Fin //break + : 'fin' + ; + +Caso + : 'caso' + ; + +Carac + : 'carac' + ; + +Pordef //default + : 'pordef' + ; + +Hacer + : 'hacer' + ; + +Doble + : 'doble' + ; + +Sino + : 'sino' + ; + +Enum + : 'enum' + ; + +Falso + : 'falso' + ; + +Flot + : 'flot' + ; + +Por + : 'por' + ; + +Si + : 'si' + ; + + +Ent + : 'Ent' + ; + +//Nulptr +// : 'nullptr' +// ; + +Retornar + : 'retornar' + ; + + +ConFirma + : 'cf' + ; + +Estruct + : 'estruct' + ; + +Interrup + : 'interrup' + ; + +Verdadero + : 'verdadero' + ; + +SinFirma + : 'sf' + ; + +Vacio + : 'vacio' + ; + +Mientras // While + : 'mientras' + ; + +ParenIzq + : '(' + ; + +ParenDer + : ')' + ; + +CorcheteIzq + : '[' + ; + +CorcheteDer + : ']' + ; + +LlaveIzq + : '{' + ; + +LlaveDer + : '}' + ; + +MenorQue + : '<' + ; + +MenorOIgualQue + : '<=' + ; + +MayorQue + : '>' + ; + +MayorOIgualQue + : '>=' + ; + +Mas + : '+' + ; + +MasMas + : '++' + ; + +Menos + : '-' + ; + +MenosMenos + : '--' + ; + +Estrella + : '*' + ; + +Div + : '/' + ; + +Mod + : '%' + ; + +Y + : '&' + ; + +O + : '|' + ; + +DesplazIzq + : '<<' + ; + +DesplazDer + : '>>' + ; + +Xor + : '^' + ; + +Complemento + : '~' + ; + +YY + : '&&' + ; + +OO + : '||' + ; + +Not + : '!' + ; + +Pregunta + : '?' + ; + +DosPuntos + : ':' + ; + +PuntoYComa + : ';' + ; + +Coma + : ',' + ; + +Asignar + : '=' + ; + +// Operadores de asignación compuesta +EstrellaAsignacion + : '*=' + ; + +DivAsignacion + : '/=' + ; + +ModAsignacion + : '%=' + ; + +MasAsignacion + : '+=' + ; + +MenosAsignacion + : '-=' + ; + + +YAsignacion + : '&=' + ; + +OAsignacion + : '|=' + ; + +DesplazIzqAsignacion + : '<<=' + ; + +DesplazDerAsignacion + : '>>=' + ; + +XorAsignacion + : '^=' + ; + +Igual + : '==' + ; + +Diferente + : '!=' + ; + +Flecha + : '->' + ; + +Punto + : '.' + ; + +Identificador + : IdentificadorSindigito (IdentificadorSindigito | Digito)* + ; + +fragment IdentificadorSindigito + : Nodigito + ; + +fragment Nodigito + : [a-zA-Z_] + ; + +fragment Digito + : [0-9] + ; + +ConstanteEntera + : ConstanteDecimal + | ConstanteOctal + | HexaConstanteDecimal + ; + +fragment ConstanteDecimal + : DigitoNoCero Digito* + ; + +fragment ConstanteOctal + : '0' DigitoOctal* + ; + +fragment HexaConstanteDecimal + : PrefijoHexadecimal DigitoHexadecimal+ + ; + +fragment PrefijoHexadecimal + : '0' [xX] + ; + +fragment DigitoNoCero + : [1-9] + ; + +fragment DigitoOctal + : [0-7] + ; + +fragment DigitoHexadecimal + : [0-9a-fA-F] + ; + +fragment SufijoEntero + : [uUlL]+ + ; + +ConstanteFlotante + : (Digito+ '.' Digito* | Digito* '.' Digito+) ([eE] [+-]? Digito+)? [fFdD]? + | Digito+ [eE] [+-]? Digito+ [fFdD]? + ; + +ConstanteCaracteres + : '\'' CCharSequence '\'' + ; + +fragment CCharSequence + : CChar+ + ; + +fragment CChar + : ~['\\\r\n] + | SecuenciaEscape + ; + +fragment SecuenciaEscape + : SecuenciaEscapeSimple + | SecuenciaEscapeOctal + | SecuenciaEscapeHexadecimal + ; + +fragment SecuenciaEscapeSimple + : '\\' ['"?abfnrtv\\] + ; + +fragment SecuenciaEscapeOctal + : '\\' DigitoOctal DigitoOctal? DigitoOctal? + ; + +fragment SecuenciaEscapeHexadecimal + : '\\x' DigitoHexadecimal+ + ; + +CadenaLiteral + : '"' SSecuenciaCaracteres? '"' + ; + +fragment SSecuenciaCaracteres + : SCaracter+ + ; + +fragment SCaracter + : ~["\\\r\n] + | SecuenciaEscape + | '\\\n' + | '\\\r\n' + ; + +Whitespace + : [ \t]+ -> channel(HIDDEN) + ; + +Newline + : ('\r' '\n'? | '\n') -> channel(HIDDEN) + ; + +BlockComment + : '/*' .*? '*/' -> channel(HIDDEN) + ; + +LineComment + : '//' ~[\r\n]* -> channel(HIDDEN) + ; + +LineCommentHash + : '#' ~[\r\n]* -> channel(HIDDEN) + ; \ No newline at end of file diff --git a/zaplangLexer.interp b/zaplangLexer.interp new file mode 100644 index 0000000..eaab9b3 --- /dev/null +++ b/zaplangLexer.interp @@ -0,0 +1,270 @@ +token literal names: +null +'bul' +'func' +'fin' +'caso' +'carac' +'pordef' +'hacer' +'doble' +'sino' +'enum' +'falso' +'flot' +'por' +'si' +'Ent' +'retornar' +'cf' +'estruct' +'interrup' +'verdadero' +'sf' +'vacio' +'mientras' +'(' +')' +'[' +']' +'{' +'}' +'<' +'<=' +'>' +'>=' +'+' +'++' +'-' +'--' +'*' +'/' +'%' +'&' +'|' +'<<' +'>>' +'^' +'~' +'&&' +'||' +'!' +'?' +':' +';' +',' +'=' +'*=' +'/=' +'%=' +'+=' +'-=' +'&=' +'|=' +'<<=' +'>>=' +'^=' +'==' +'!=' +'->' +'.' +null +null +null +null +null +null +null +null +null +null + +token symbolic names: +null +Bul +Func +Fin +Caso +Carac +Pordef +Hacer +Doble +Sino +Enum +Falso +Flot +Por +Si +Ent +Retornar +ConFirma +Estruct +Interrup +Verdadero +SinFirma +Vacio +Mientras +ParenIzq +ParenDer +CorcheteIzq +CorcheteDer +LlaveIzq +LlaveDer +MenorQue +MenorOIgualQue +MayorQue +MayorOIgualQue +Mas +MasMas +Menos +MenosMenos +Estrella +Div +Mod +Y +O +DesplazIzq +DesplazDer +Xor +Complemento +YY +OO +Not +Pregunta +DosPuntos +PuntoYComa +Coma +Asignar +EstrellaAsignacion +DivAsignacion +ModAsignacion +MasAsignacion +MenosAsignacion +YAsignacion +OAsignacion +DesplazIzqAsignacion +DesplazDerAsignacion +XorAsignacion +Igual +Diferente +Flecha +Punto +Identificador +ConstanteEntera +ConstanteFlotante +ConstanteCaracteres +CadenaLiteral +Whitespace +Newline +BlockComment +LineComment +LineCommentHash + +rule names: +Bul +Func +Fin +Caso +Carac +Pordef +Hacer +Doble +Sino +Enum +Falso +Flot +Por +Si +Ent +Retornar +ConFirma +Estruct +Interrup +Verdadero +SinFirma +Vacio +Mientras +ParenIzq +ParenDer +CorcheteIzq +CorcheteDer +LlaveIzq +LlaveDer +MenorQue +MenorOIgualQue +MayorQue +MayorOIgualQue +Mas +MasMas +Menos +MenosMenos +Estrella +Div +Mod +Y +O +DesplazIzq +DesplazDer +Xor +Complemento +YY +OO +Not +Pregunta +DosPuntos +PuntoYComa +Coma +Asignar +EstrellaAsignacion +DivAsignacion +ModAsignacion +MasAsignacion +MenosAsignacion +YAsignacion +OAsignacion +DesplazIzqAsignacion +DesplazDerAsignacion +XorAsignacion +Igual +Diferente +Flecha +Punto +Identificador +IdentificadorSindigito +Nodigito +Digito +ConstanteEntera +ConstanteDecimal +ConstanteOctal +HexaConstanteDecimal +PrefijoHexadecimal +DigitoNoCero +DigitoOctal +DigitoHexadecimal +SufijoEntero +ConstanteFlotante +ConstanteCaracteres +CCharSequence +CChar +SecuenciaEscape +SecuenciaEscapeSimple +SecuenciaEscapeOctal +SecuenciaEscapeHexadecimal +CadenaLiteral +SSecuenciaCaracteres +SCaracter +Whitespace +Newline +BlockComment +LineComment +LineCommentHash + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[4, 0, 78, 659, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 2, 49, 7, 49, 2, 50, 7, 50, 2, 51, 7, 51, 2, 52, 7, 52, 2, 53, 7, 53, 2, 54, 7, 54, 2, 55, 7, 55, 2, 56, 7, 56, 2, 57, 7, 57, 2, 58, 7, 58, 2, 59, 7, 59, 2, 60, 7, 60, 2, 61, 7, 61, 2, 62, 7, 62, 2, 63, 7, 63, 2, 64, 7, 64, 2, 65, 7, 65, 2, 66, 7, 66, 2, 67, 7, 67, 2, 68, 7, 68, 2, 69, 7, 69, 2, 70, 7, 70, 2, 71, 7, 71, 2, 72, 7, 72, 2, 73, 7, 73, 2, 74, 7, 74, 2, 75, 7, 75, 2, 76, 7, 76, 2, 77, 7, 77, 2, 78, 7, 78, 2, 79, 7, 79, 2, 80, 7, 80, 2, 81, 7, 81, 2, 82, 7, 82, 2, 83, 7, 83, 2, 84, 7, 84, 2, 85, 7, 85, 2, 86, 7, 86, 2, 87, 7, 87, 2, 88, 7, 88, 2, 89, 7, 89, 2, 90, 7, 90, 2, 91, 7, 91, 2, 92, 7, 92, 2, 93, 7, 93, 2, 94, 7, 94, 2, 95, 7, 95, 2, 96, 7, 96, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 25, 1, 25, 1, 26, 1, 26, 1, 27, 1, 27, 1, 28, 1, 28, 1, 29, 1, 29, 1, 30, 1, 30, 1, 30, 1, 31, 1, 31, 1, 32, 1, 32, 1, 32, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 35, 1, 35, 1, 36, 1, 36, 1, 36, 1, 37, 1, 37, 1, 38, 1, 38, 1, 39, 1, 39, 1, 40, 1, 40, 1, 41, 1, 41, 1, 42, 1, 42, 1, 42, 1, 43, 1, 43, 1, 43, 1, 44, 1, 44, 1, 45, 1, 45, 1, 46, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 1, 48, 1, 48, 1, 49, 1, 49, 1, 50, 1, 50, 1, 51, 1, 51, 1, 52, 1, 52, 1, 53, 1, 53, 1, 54, 1, 54, 1, 54, 1, 55, 1, 55, 1, 55, 1, 56, 1, 56, 1, 56, 1, 57, 1, 57, 1, 57, 1, 58, 1, 58, 1, 58, 1, 59, 1, 59, 1, 59, 1, 60, 1, 60, 1, 60, 1, 61, 1, 61, 1, 61, 1, 61, 1, 62, 1, 62, 1, 62, 1, 62, 1, 63, 1, 63, 1, 63, 1, 64, 1, 64, 1, 64, 1, 65, 1, 65, 1, 65, 1, 66, 1, 66, 1, 66, 1, 67, 1, 67, 1, 68, 1, 68, 1, 68, 5, 68, 444, 8, 68, 10, 68, 12, 68, 447, 9, 68, 1, 69, 1, 69, 1, 70, 1, 70, 1, 71, 1, 71, 1, 72, 1, 72, 1, 72, 3, 72, 458, 8, 72, 1, 73, 1, 73, 5, 73, 462, 8, 73, 10, 73, 12, 73, 465, 9, 73, 1, 74, 1, 74, 5, 74, 469, 8, 74, 10, 74, 12, 74, 472, 9, 74, 1, 75, 1, 75, 4, 75, 476, 8, 75, 11, 75, 12, 75, 477, 1, 76, 1, 76, 1, 76, 1, 77, 1, 77, 1, 78, 1, 78, 1, 79, 1, 79, 1, 80, 4, 80, 490, 8, 80, 11, 80, 12, 80, 491, 1, 81, 4, 81, 495, 8, 81, 11, 81, 12, 81, 496, 1, 81, 1, 81, 5, 81, 501, 8, 81, 10, 81, 12, 81, 504, 9, 81, 1, 81, 5, 81, 507, 8, 81, 10, 81, 12, 81, 510, 9, 81, 1, 81, 1, 81, 4, 81, 514, 8, 81, 11, 81, 12, 81, 515, 3, 81, 518, 8, 81, 1, 81, 1, 81, 3, 81, 522, 8, 81, 1, 81, 4, 81, 525, 8, 81, 11, 81, 12, 81, 526, 3, 81, 529, 8, 81, 1, 81, 3, 81, 532, 8, 81, 1, 81, 4, 81, 535, 8, 81, 11, 81, 12, 81, 536, 1, 81, 1, 81, 3, 81, 541, 8, 81, 1, 81, 4, 81, 544, 8, 81, 11, 81, 12, 81, 545, 1, 81, 3, 81, 549, 8, 81, 3, 81, 551, 8, 81, 1, 82, 1, 82, 1, 82, 1, 82, 1, 83, 4, 83, 558, 8, 83, 11, 83, 12, 83, 559, 1, 84, 1, 84, 3, 84, 564, 8, 84, 1, 85, 1, 85, 1, 85, 3, 85, 569, 8, 85, 1, 86, 1, 86, 1, 86, 1, 87, 1, 87, 1, 87, 3, 87, 577, 8, 87, 1, 87, 3, 87, 580, 8, 87, 1, 88, 1, 88, 1, 88, 1, 88, 4, 88, 586, 8, 88, 11, 88, 12, 88, 587, 1, 89, 1, 89, 3, 89, 592, 8, 89, 1, 89, 1, 89, 1, 90, 4, 90, 597, 8, 90, 11, 90, 12, 90, 598, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 1, 91, 3, 91, 608, 8, 91, 1, 92, 4, 92, 611, 8, 92, 11, 92, 12, 92, 612, 1, 92, 1, 92, 1, 93, 1, 93, 3, 93, 619, 8, 93, 1, 93, 3, 93, 622, 8, 93, 1, 93, 1, 93, 1, 94, 1, 94, 1, 94, 1, 94, 5, 94, 630, 8, 94, 10, 94, 12, 94, 633, 9, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 94, 1, 95, 1, 95, 1, 95, 1, 95, 5, 95, 644, 8, 95, 10, 95, 12, 95, 647, 9, 95, 1, 95, 1, 95, 1, 96, 1, 96, 5, 96, 653, 8, 96, 10, 96, 12, 96, 656, 9, 96, 1, 96, 1, 96, 1, 631, 0, 97, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 41, 21, 43, 22, 45, 23, 47, 24, 49, 25, 51, 26, 53, 27, 55, 28, 57, 29, 59, 30, 61, 31, 63, 32, 65, 33, 67, 34, 69, 35, 71, 36, 73, 37, 75, 38, 77, 39, 79, 40, 81, 41, 83, 42, 85, 43, 87, 44, 89, 45, 91, 46, 93, 47, 95, 48, 97, 49, 99, 50, 101, 51, 103, 52, 105, 53, 107, 54, 109, 55, 111, 56, 113, 57, 115, 58, 117, 59, 119, 60, 121, 61, 123, 62, 125, 63, 127, 64, 129, 65, 131, 66, 133, 67, 135, 68, 137, 69, 139, 0, 141, 0, 143, 0, 145, 70, 147, 0, 149, 0, 151, 0, 153, 0, 155, 0, 157, 0, 159, 0, 161, 0, 163, 71, 165, 72, 167, 0, 169, 0, 171, 0, 173, 0, 175, 0, 177, 0, 179, 73, 181, 0, 183, 0, 185, 74, 187, 75, 189, 76, 191, 77, 193, 78, 1, 0, 15, 3, 0, 65, 90, 95, 95, 97, 122, 1, 0, 48, 57, 2, 0, 88, 88, 120, 120, 1, 0, 49, 57, 1, 0, 48, 55, 3, 0, 48, 57, 65, 70, 97, 102, 4, 0, 76, 76, 85, 85, 108, 108, 117, 117, 2, 0, 69, 69, 101, 101, 2, 0, 43, 43, 45, 45, 4, 0, 68, 68, 70, 70, 100, 100, 102, 102, 4, 0, 10, 10, 13, 13, 39, 39, 92, 92, 10, 0, 34, 34, 39, 39, 63, 63, 92, 92, 97, 98, 102, 102, 110, 110, 114, 114, 116, 116, 118, 118, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 2, 0, 9, 9, 32, 32, 2, 0, 10, 10, 13, 13, 679, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 0, 41, 1, 0, 0, 0, 0, 43, 1, 0, 0, 0, 0, 45, 1, 0, 0, 0, 0, 47, 1, 0, 0, 0, 0, 49, 1, 0, 0, 0, 0, 51, 1, 0, 0, 0, 0, 53, 1, 0, 0, 0, 0, 55, 1, 0, 0, 0, 0, 57, 1, 0, 0, 0, 0, 59, 1, 0, 0, 0, 0, 61, 1, 0, 0, 0, 0, 63, 1, 0, 0, 0, 0, 65, 1, 0, 0, 0, 0, 67, 1, 0, 0, 0, 0, 69, 1, 0, 0, 0, 0, 71, 1, 0, 0, 0, 0, 73, 1, 0, 0, 0, 0, 75, 1, 0, 0, 0, 0, 77, 1, 0, 0, 0, 0, 79, 1, 0, 0, 0, 0, 81, 1, 0, 0, 0, 0, 83, 1, 0, 0, 0, 0, 85, 1, 0, 0, 0, 0, 87, 1, 0, 0, 0, 0, 89, 1, 0, 0, 0, 0, 91, 1, 0, 0, 0, 0, 93, 1, 0, 0, 0, 0, 95, 1, 0, 0, 0, 0, 97, 1, 0, 0, 0, 0, 99, 1, 0, 0, 0, 0, 101, 1, 0, 0, 0, 0, 103, 1, 0, 0, 0, 0, 105, 1, 0, 0, 0, 0, 107, 1, 0, 0, 0, 0, 109, 1, 0, 0, 0, 0, 111, 1, 0, 0, 0, 0, 113, 1, 0, 0, 0, 0, 115, 1, 0, 0, 0, 0, 117, 1, 0, 0, 0, 0, 119, 1, 0, 0, 0, 0, 121, 1, 0, 0, 0, 0, 123, 1, 0, 0, 0, 0, 125, 1, 0, 0, 0, 0, 127, 1, 0, 0, 0, 0, 129, 1, 0, 0, 0, 0, 131, 1, 0, 0, 0, 0, 133, 1, 0, 0, 0, 0, 135, 1, 0, 0, 0, 0, 137, 1, 0, 0, 0, 0, 145, 1, 0, 0, 0, 0, 163, 1, 0, 0, 0, 0, 165, 1, 0, 0, 0, 0, 179, 1, 0, 0, 0, 0, 185, 1, 0, 0, 0, 0, 187, 1, 0, 0, 0, 0, 189, 1, 0, 0, 0, 0, 191, 1, 0, 0, 0, 0, 193, 1, 0, 0, 0, 1, 195, 1, 0, 0, 0, 3, 199, 1, 0, 0, 0, 5, 204, 1, 0, 0, 0, 7, 208, 1, 0, 0, 0, 9, 213, 1, 0, 0, 0, 11, 219, 1, 0, 0, 0, 13, 226, 1, 0, 0, 0, 15, 232, 1, 0, 0, 0, 17, 238, 1, 0, 0, 0, 19, 243, 1, 0, 0, 0, 21, 248, 1, 0, 0, 0, 23, 254, 1, 0, 0, 0, 25, 259, 1, 0, 0, 0, 27, 263, 1, 0, 0, 0, 29, 266, 1, 0, 0, 0, 31, 270, 1, 0, 0, 0, 33, 279, 1, 0, 0, 0, 35, 282, 1, 0, 0, 0, 37, 290, 1, 0, 0, 0, 39, 299, 1, 0, 0, 0, 41, 309, 1, 0, 0, 0, 43, 312, 1, 0, 0, 0, 45, 318, 1, 0, 0, 0, 47, 327, 1, 0, 0, 0, 49, 329, 1, 0, 0, 0, 51, 331, 1, 0, 0, 0, 53, 333, 1, 0, 0, 0, 55, 335, 1, 0, 0, 0, 57, 337, 1, 0, 0, 0, 59, 339, 1, 0, 0, 0, 61, 341, 1, 0, 0, 0, 63, 344, 1, 0, 0, 0, 65, 346, 1, 0, 0, 0, 67, 349, 1, 0, 0, 0, 69, 351, 1, 0, 0, 0, 71, 354, 1, 0, 0, 0, 73, 356, 1, 0, 0, 0, 75, 359, 1, 0, 0, 0, 77, 361, 1, 0, 0, 0, 79, 363, 1, 0, 0, 0, 81, 365, 1, 0, 0, 0, 83, 367, 1, 0, 0, 0, 85, 369, 1, 0, 0, 0, 87, 372, 1, 0, 0, 0, 89, 375, 1, 0, 0, 0, 91, 377, 1, 0, 0, 0, 93, 379, 1, 0, 0, 0, 95, 382, 1, 0, 0, 0, 97, 385, 1, 0, 0, 0, 99, 387, 1, 0, 0, 0, 101, 389, 1, 0, 0, 0, 103, 391, 1, 0, 0, 0, 105, 393, 1, 0, 0, 0, 107, 395, 1, 0, 0, 0, 109, 397, 1, 0, 0, 0, 111, 400, 1, 0, 0, 0, 113, 403, 1, 0, 0, 0, 115, 406, 1, 0, 0, 0, 117, 409, 1, 0, 0, 0, 119, 412, 1, 0, 0, 0, 121, 415, 1, 0, 0, 0, 123, 418, 1, 0, 0, 0, 125, 422, 1, 0, 0, 0, 127, 426, 1, 0, 0, 0, 129, 429, 1, 0, 0, 0, 131, 432, 1, 0, 0, 0, 133, 435, 1, 0, 0, 0, 135, 438, 1, 0, 0, 0, 137, 440, 1, 0, 0, 0, 139, 448, 1, 0, 0, 0, 141, 450, 1, 0, 0, 0, 143, 452, 1, 0, 0, 0, 145, 457, 1, 0, 0, 0, 147, 459, 1, 0, 0, 0, 149, 466, 1, 0, 0, 0, 151, 473, 1, 0, 0, 0, 153, 479, 1, 0, 0, 0, 155, 482, 1, 0, 0, 0, 157, 484, 1, 0, 0, 0, 159, 486, 1, 0, 0, 0, 161, 489, 1, 0, 0, 0, 163, 550, 1, 0, 0, 0, 165, 552, 1, 0, 0, 0, 167, 557, 1, 0, 0, 0, 169, 563, 1, 0, 0, 0, 171, 568, 1, 0, 0, 0, 173, 570, 1, 0, 0, 0, 175, 573, 1, 0, 0, 0, 177, 581, 1, 0, 0, 0, 179, 589, 1, 0, 0, 0, 181, 596, 1, 0, 0, 0, 183, 607, 1, 0, 0, 0, 185, 610, 1, 0, 0, 0, 187, 621, 1, 0, 0, 0, 189, 625, 1, 0, 0, 0, 191, 639, 1, 0, 0, 0, 193, 650, 1, 0, 0, 0, 195, 196, 5, 98, 0, 0, 196, 197, 5, 117, 0, 0, 197, 198, 5, 108, 0, 0, 198, 2, 1, 0, 0, 0, 199, 200, 5, 102, 0, 0, 200, 201, 5, 117, 0, 0, 201, 202, 5, 110, 0, 0, 202, 203, 5, 99, 0, 0, 203, 4, 1, 0, 0, 0, 204, 205, 5, 102, 0, 0, 205, 206, 5, 105, 0, 0, 206, 207, 5, 110, 0, 0, 207, 6, 1, 0, 0, 0, 208, 209, 5, 99, 0, 0, 209, 210, 5, 97, 0, 0, 210, 211, 5, 115, 0, 0, 211, 212, 5, 111, 0, 0, 212, 8, 1, 0, 0, 0, 213, 214, 5, 99, 0, 0, 214, 215, 5, 97, 0, 0, 215, 216, 5, 114, 0, 0, 216, 217, 5, 97, 0, 0, 217, 218, 5, 99, 0, 0, 218, 10, 1, 0, 0, 0, 219, 220, 5, 112, 0, 0, 220, 221, 5, 111, 0, 0, 221, 222, 5, 114, 0, 0, 222, 223, 5, 100, 0, 0, 223, 224, 5, 101, 0, 0, 224, 225, 5, 102, 0, 0, 225, 12, 1, 0, 0, 0, 226, 227, 5, 104, 0, 0, 227, 228, 5, 97, 0, 0, 228, 229, 5, 99, 0, 0, 229, 230, 5, 101, 0, 0, 230, 231, 5, 114, 0, 0, 231, 14, 1, 0, 0, 0, 232, 233, 5, 100, 0, 0, 233, 234, 5, 111, 0, 0, 234, 235, 5, 98, 0, 0, 235, 236, 5, 108, 0, 0, 236, 237, 5, 101, 0, 0, 237, 16, 1, 0, 0, 0, 238, 239, 5, 115, 0, 0, 239, 240, 5, 105, 0, 0, 240, 241, 5, 110, 0, 0, 241, 242, 5, 111, 0, 0, 242, 18, 1, 0, 0, 0, 243, 244, 5, 101, 0, 0, 244, 245, 5, 110, 0, 0, 245, 246, 5, 117, 0, 0, 246, 247, 5, 109, 0, 0, 247, 20, 1, 0, 0, 0, 248, 249, 5, 102, 0, 0, 249, 250, 5, 97, 0, 0, 250, 251, 5, 108, 0, 0, 251, 252, 5, 115, 0, 0, 252, 253, 5, 111, 0, 0, 253, 22, 1, 0, 0, 0, 254, 255, 5, 102, 0, 0, 255, 256, 5, 108, 0, 0, 256, 257, 5, 111, 0, 0, 257, 258, 5, 116, 0, 0, 258, 24, 1, 0, 0, 0, 259, 260, 5, 112, 0, 0, 260, 261, 5, 111, 0, 0, 261, 262, 5, 114, 0, 0, 262, 26, 1, 0, 0, 0, 263, 264, 5, 115, 0, 0, 264, 265, 5, 105, 0, 0, 265, 28, 1, 0, 0, 0, 266, 267, 5, 69, 0, 0, 267, 268, 5, 110, 0, 0, 268, 269, 5, 116, 0, 0, 269, 30, 1, 0, 0, 0, 270, 271, 5, 114, 0, 0, 271, 272, 5, 101, 0, 0, 272, 273, 5, 116, 0, 0, 273, 274, 5, 111, 0, 0, 274, 275, 5, 114, 0, 0, 275, 276, 5, 110, 0, 0, 276, 277, 5, 97, 0, 0, 277, 278, 5, 114, 0, 0, 278, 32, 1, 0, 0, 0, 279, 280, 5, 99, 0, 0, 280, 281, 5, 102, 0, 0, 281, 34, 1, 0, 0, 0, 282, 283, 5, 101, 0, 0, 283, 284, 5, 115, 0, 0, 284, 285, 5, 116, 0, 0, 285, 286, 5, 114, 0, 0, 286, 287, 5, 117, 0, 0, 287, 288, 5, 99, 0, 0, 288, 289, 5, 116, 0, 0, 289, 36, 1, 0, 0, 0, 290, 291, 5, 105, 0, 0, 291, 292, 5, 110, 0, 0, 292, 293, 5, 116, 0, 0, 293, 294, 5, 101, 0, 0, 294, 295, 5, 114, 0, 0, 295, 296, 5, 114, 0, 0, 296, 297, 5, 117, 0, 0, 297, 298, 5, 112, 0, 0, 298, 38, 1, 0, 0, 0, 299, 300, 5, 118, 0, 0, 300, 301, 5, 101, 0, 0, 301, 302, 5, 114, 0, 0, 302, 303, 5, 100, 0, 0, 303, 304, 5, 97, 0, 0, 304, 305, 5, 100, 0, 0, 305, 306, 5, 101, 0, 0, 306, 307, 5, 114, 0, 0, 307, 308, 5, 111, 0, 0, 308, 40, 1, 0, 0, 0, 309, 310, 5, 115, 0, 0, 310, 311, 5, 102, 0, 0, 311, 42, 1, 0, 0, 0, 312, 313, 5, 118, 0, 0, 313, 314, 5, 97, 0, 0, 314, 315, 5, 99, 0, 0, 315, 316, 5, 105, 0, 0, 316, 317, 5, 111, 0, 0, 317, 44, 1, 0, 0, 0, 318, 319, 5, 109, 0, 0, 319, 320, 5, 105, 0, 0, 320, 321, 5, 101, 0, 0, 321, 322, 5, 110, 0, 0, 322, 323, 5, 116, 0, 0, 323, 324, 5, 114, 0, 0, 324, 325, 5, 97, 0, 0, 325, 326, 5, 115, 0, 0, 326, 46, 1, 0, 0, 0, 327, 328, 5, 40, 0, 0, 328, 48, 1, 0, 0, 0, 329, 330, 5, 41, 0, 0, 330, 50, 1, 0, 0, 0, 331, 332, 5, 91, 0, 0, 332, 52, 1, 0, 0, 0, 333, 334, 5, 93, 0, 0, 334, 54, 1, 0, 0, 0, 335, 336, 5, 123, 0, 0, 336, 56, 1, 0, 0, 0, 337, 338, 5, 125, 0, 0, 338, 58, 1, 0, 0, 0, 339, 340, 5, 60, 0, 0, 340, 60, 1, 0, 0, 0, 341, 342, 5, 60, 0, 0, 342, 343, 5, 61, 0, 0, 343, 62, 1, 0, 0, 0, 344, 345, 5, 62, 0, 0, 345, 64, 1, 0, 0, 0, 346, 347, 5, 62, 0, 0, 347, 348, 5, 61, 0, 0, 348, 66, 1, 0, 0, 0, 349, 350, 5, 43, 0, 0, 350, 68, 1, 0, 0, 0, 351, 352, 5, 43, 0, 0, 352, 353, 5, 43, 0, 0, 353, 70, 1, 0, 0, 0, 354, 355, 5, 45, 0, 0, 355, 72, 1, 0, 0, 0, 356, 357, 5, 45, 0, 0, 357, 358, 5, 45, 0, 0, 358, 74, 1, 0, 0, 0, 359, 360, 5, 42, 0, 0, 360, 76, 1, 0, 0, 0, 361, 362, 5, 47, 0, 0, 362, 78, 1, 0, 0, 0, 363, 364, 5, 37, 0, 0, 364, 80, 1, 0, 0, 0, 365, 366, 5, 38, 0, 0, 366, 82, 1, 0, 0, 0, 367, 368, 5, 124, 0, 0, 368, 84, 1, 0, 0, 0, 369, 370, 5, 60, 0, 0, 370, 371, 5, 60, 0, 0, 371, 86, 1, 0, 0, 0, 372, 373, 5, 62, 0, 0, 373, 374, 5, 62, 0, 0, 374, 88, 1, 0, 0, 0, 375, 376, 5, 94, 0, 0, 376, 90, 1, 0, 0, 0, 377, 378, 5, 126, 0, 0, 378, 92, 1, 0, 0, 0, 379, 380, 5, 38, 0, 0, 380, 381, 5, 38, 0, 0, 381, 94, 1, 0, 0, 0, 382, 383, 5, 124, 0, 0, 383, 384, 5, 124, 0, 0, 384, 96, 1, 0, 0, 0, 385, 386, 5, 33, 0, 0, 386, 98, 1, 0, 0, 0, 387, 388, 5, 63, 0, 0, 388, 100, 1, 0, 0, 0, 389, 390, 5, 58, 0, 0, 390, 102, 1, 0, 0, 0, 391, 392, 5, 59, 0, 0, 392, 104, 1, 0, 0, 0, 393, 394, 5, 44, 0, 0, 394, 106, 1, 0, 0, 0, 395, 396, 5, 61, 0, 0, 396, 108, 1, 0, 0, 0, 397, 398, 5, 42, 0, 0, 398, 399, 5, 61, 0, 0, 399, 110, 1, 0, 0, 0, 400, 401, 5, 47, 0, 0, 401, 402, 5, 61, 0, 0, 402, 112, 1, 0, 0, 0, 403, 404, 5, 37, 0, 0, 404, 405, 5, 61, 0, 0, 405, 114, 1, 0, 0, 0, 406, 407, 5, 43, 0, 0, 407, 408, 5, 61, 0, 0, 408, 116, 1, 0, 0, 0, 409, 410, 5, 45, 0, 0, 410, 411, 5, 61, 0, 0, 411, 118, 1, 0, 0, 0, 412, 413, 5, 38, 0, 0, 413, 414, 5, 61, 0, 0, 414, 120, 1, 0, 0, 0, 415, 416, 5, 124, 0, 0, 416, 417, 5, 61, 0, 0, 417, 122, 1, 0, 0, 0, 418, 419, 5, 60, 0, 0, 419, 420, 5, 60, 0, 0, 420, 421, 5, 61, 0, 0, 421, 124, 1, 0, 0, 0, 422, 423, 5, 62, 0, 0, 423, 424, 5, 62, 0, 0, 424, 425, 5, 61, 0, 0, 425, 126, 1, 0, 0, 0, 426, 427, 5, 94, 0, 0, 427, 428, 5, 61, 0, 0, 428, 128, 1, 0, 0, 0, 429, 430, 5, 61, 0, 0, 430, 431, 5, 61, 0, 0, 431, 130, 1, 0, 0, 0, 432, 433, 5, 33, 0, 0, 433, 434, 5, 61, 0, 0, 434, 132, 1, 0, 0, 0, 435, 436, 5, 45, 0, 0, 436, 437, 5, 62, 0, 0, 437, 134, 1, 0, 0, 0, 438, 439, 5, 46, 0, 0, 439, 136, 1, 0, 0, 0, 440, 445, 3, 139, 69, 0, 441, 444, 3, 139, 69, 0, 442, 444, 3, 143, 71, 0, 443, 441, 1, 0, 0, 0, 443, 442, 1, 0, 0, 0, 444, 447, 1, 0, 0, 0, 445, 443, 1, 0, 0, 0, 445, 446, 1, 0, 0, 0, 446, 138, 1, 0, 0, 0, 447, 445, 1, 0, 0, 0, 448, 449, 3, 141, 70, 0, 449, 140, 1, 0, 0, 0, 450, 451, 7, 0, 0, 0, 451, 142, 1, 0, 0, 0, 452, 453, 7, 1, 0, 0, 453, 144, 1, 0, 0, 0, 454, 458, 3, 147, 73, 0, 455, 458, 3, 149, 74, 0, 456, 458, 3, 151, 75, 0, 457, 454, 1, 0, 0, 0, 457, 455, 1, 0, 0, 0, 457, 456, 1, 0, 0, 0, 458, 146, 1, 0, 0, 0, 459, 463, 3, 155, 77, 0, 460, 462, 3, 143, 71, 0, 461, 460, 1, 0, 0, 0, 462, 465, 1, 0, 0, 0, 463, 461, 1, 0, 0, 0, 463, 464, 1, 0, 0, 0, 464, 148, 1, 0, 0, 0, 465, 463, 1, 0, 0, 0, 466, 470, 5, 48, 0, 0, 467, 469, 3, 157, 78, 0, 468, 467, 1, 0, 0, 0, 469, 472, 1, 0, 0, 0, 470, 468, 1, 0, 0, 0, 470, 471, 1, 0, 0, 0, 471, 150, 1, 0, 0, 0, 472, 470, 1, 0, 0, 0, 473, 475, 3, 153, 76, 0, 474, 476, 3, 159, 79, 0, 475, 474, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, 477, 475, 1, 0, 0, 0, 477, 478, 1, 0, 0, 0, 478, 152, 1, 0, 0, 0, 479, 480, 5, 48, 0, 0, 480, 481, 7, 2, 0, 0, 481, 154, 1, 0, 0, 0, 482, 483, 7, 3, 0, 0, 483, 156, 1, 0, 0, 0, 484, 485, 7, 4, 0, 0, 485, 158, 1, 0, 0, 0, 486, 487, 7, 5, 0, 0, 487, 160, 1, 0, 0, 0, 488, 490, 7, 6, 0, 0, 489, 488, 1, 0, 0, 0, 490, 491, 1, 0, 0, 0, 491, 489, 1, 0, 0, 0, 491, 492, 1, 0, 0, 0, 492, 162, 1, 0, 0, 0, 493, 495, 3, 143, 71, 0, 494, 493, 1, 0, 0, 0, 495, 496, 1, 0, 0, 0, 496, 494, 1, 0, 0, 0, 496, 497, 1, 0, 0, 0, 497, 498, 1, 0, 0, 0, 498, 502, 5, 46, 0, 0, 499, 501, 3, 143, 71, 0, 500, 499, 1, 0, 0, 0, 501, 504, 1, 0, 0, 0, 502, 500, 1, 0, 0, 0, 502, 503, 1, 0, 0, 0, 503, 518, 1, 0, 0, 0, 504, 502, 1, 0, 0, 0, 505, 507, 3, 143, 71, 0, 506, 505, 1, 0, 0, 0, 507, 510, 1, 0, 0, 0, 508, 506, 1, 0, 0, 0, 508, 509, 1, 0, 0, 0, 509, 511, 1, 0, 0, 0, 510, 508, 1, 0, 0, 0, 511, 513, 5, 46, 0, 0, 512, 514, 3, 143, 71, 0, 513, 512, 1, 0, 0, 0, 514, 515, 1, 0, 0, 0, 515, 513, 1, 0, 0, 0, 515, 516, 1, 0, 0, 0, 516, 518, 1, 0, 0, 0, 517, 494, 1, 0, 0, 0, 517, 508, 1, 0, 0, 0, 518, 528, 1, 0, 0, 0, 519, 521, 7, 7, 0, 0, 520, 522, 7, 8, 0, 0, 521, 520, 1, 0, 0, 0, 521, 522, 1, 0, 0, 0, 522, 524, 1, 0, 0, 0, 523, 525, 3, 143, 71, 0, 524, 523, 1, 0, 0, 0, 525, 526, 1, 0, 0, 0, 526, 524, 1, 0, 0, 0, 526, 527, 1, 0, 0, 0, 527, 529, 1, 0, 0, 0, 528, 519, 1, 0, 0, 0, 528, 529, 1, 0, 0, 0, 529, 531, 1, 0, 0, 0, 530, 532, 7, 9, 0, 0, 531, 530, 1, 0, 0, 0, 531, 532, 1, 0, 0, 0, 532, 551, 1, 0, 0, 0, 533, 535, 3, 143, 71, 0, 534, 533, 1, 0, 0, 0, 535, 536, 1, 0, 0, 0, 536, 534, 1, 0, 0, 0, 536, 537, 1, 0, 0, 0, 537, 538, 1, 0, 0, 0, 538, 540, 7, 7, 0, 0, 539, 541, 7, 8, 0, 0, 540, 539, 1, 0, 0, 0, 540, 541, 1, 0, 0, 0, 541, 543, 1, 0, 0, 0, 542, 544, 3, 143, 71, 0, 543, 542, 1, 0, 0, 0, 544, 545, 1, 0, 0, 0, 545, 543, 1, 0, 0, 0, 545, 546, 1, 0, 0, 0, 546, 548, 1, 0, 0, 0, 547, 549, 7, 9, 0, 0, 548, 547, 1, 0, 0, 0, 548, 549, 1, 0, 0, 0, 549, 551, 1, 0, 0, 0, 550, 517, 1, 0, 0, 0, 550, 534, 1, 0, 0, 0, 551, 164, 1, 0, 0, 0, 552, 553, 5, 39, 0, 0, 553, 554, 3, 167, 83, 0, 554, 555, 5, 39, 0, 0, 555, 166, 1, 0, 0, 0, 556, 558, 3, 169, 84, 0, 557, 556, 1, 0, 0, 0, 558, 559, 1, 0, 0, 0, 559, 557, 1, 0, 0, 0, 559, 560, 1, 0, 0, 0, 560, 168, 1, 0, 0, 0, 561, 564, 8, 10, 0, 0, 562, 564, 3, 171, 85, 0, 563, 561, 1, 0, 0, 0, 563, 562, 1, 0, 0, 0, 564, 170, 1, 0, 0, 0, 565, 569, 3, 173, 86, 0, 566, 569, 3, 175, 87, 0, 567, 569, 3, 177, 88, 0, 568, 565, 1, 0, 0, 0, 568, 566, 1, 0, 0, 0, 568, 567, 1, 0, 0, 0, 569, 172, 1, 0, 0, 0, 570, 571, 5, 92, 0, 0, 571, 572, 7, 11, 0, 0, 572, 174, 1, 0, 0, 0, 573, 574, 5, 92, 0, 0, 574, 576, 3, 157, 78, 0, 575, 577, 3, 157, 78, 0, 576, 575, 1, 0, 0, 0, 576, 577, 1, 0, 0, 0, 577, 579, 1, 0, 0, 0, 578, 580, 3, 157, 78, 0, 579, 578, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 176, 1, 0, 0, 0, 581, 582, 5, 92, 0, 0, 582, 583, 5, 120, 0, 0, 583, 585, 1, 0, 0, 0, 584, 586, 3, 159, 79, 0, 585, 584, 1, 0, 0, 0, 586, 587, 1, 0, 0, 0, 587, 585, 1, 0, 0, 0, 587, 588, 1, 0, 0, 0, 588, 178, 1, 0, 0, 0, 589, 591, 5, 34, 0, 0, 590, 592, 3, 181, 90, 0, 591, 590, 1, 0, 0, 0, 591, 592, 1, 0, 0, 0, 592, 593, 1, 0, 0, 0, 593, 594, 5, 34, 0, 0, 594, 180, 1, 0, 0, 0, 595, 597, 3, 183, 91, 0, 596, 595, 1, 0, 0, 0, 597, 598, 1, 0, 0, 0, 598, 596, 1, 0, 0, 0, 598, 599, 1, 0, 0, 0, 599, 182, 1, 0, 0, 0, 600, 608, 8, 12, 0, 0, 601, 608, 3, 171, 85, 0, 602, 603, 5, 92, 0, 0, 603, 608, 5, 10, 0, 0, 604, 605, 5, 92, 0, 0, 605, 606, 5, 13, 0, 0, 606, 608, 5, 10, 0, 0, 607, 600, 1, 0, 0, 0, 607, 601, 1, 0, 0, 0, 607, 602, 1, 0, 0, 0, 607, 604, 1, 0, 0, 0, 608, 184, 1, 0, 0, 0, 609, 611, 7, 13, 0, 0, 610, 609, 1, 0, 0, 0, 611, 612, 1, 0, 0, 0, 612, 610, 1, 0, 0, 0, 612, 613, 1, 0, 0, 0, 613, 614, 1, 0, 0, 0, 614, 615, 6, 92, 0, 0, 615, 186, 1, 0, 0, 0, 616, 618, 5, 13, 0, 0, 617, 619, 5, 10, 0, 0, 618, 617, 1, 0, 0, 0, 618, 619, 1, 0, 0, 0, 619, 622, 1, 0, 0, 0, 620, 622, 5, 10, 0, 0, 621, 616, 1, 0, 0, 0, 621, 620, 1, 0, 0, 0, 622, 623, 1, 0, 0, 0, 623, 624, 6, 93, 0, 0, 624, 188, 1, 0, 0, 0, 625, 626, 5, 47, 0, 0, 626, 627, 5, 42, 0, 0, 627, 631, 1, 0, 0, 0, 628, 630, 9, 0, 0, 0, 629, 628, 1, 0, 0, 0, 630, 633, 1, 0, 0, 0, 631, 632, 1, 0, 0, 0, 631, 629, 1, 0, 0, 0, 632, 634, 1, 0, 0, 0, 633, 631, 1, 0, 0, 0, 634, 635, 5, 42, 0, 0, 635, 636, 5, 47, 0, 0, 636, 637, 1, 0, 0, 0, 637, 638, 6, 94, 0, 0, 638, 190, 1, 0, 0, 0, 639, 640, 5, 47, 0, 0, 640, 641, 5, 47, 0, 0, 641, 645, 1, 0, 0, 0, 642, 644, 8, 14, 0, 0, 643, 642, 1, 0, 0, 0, 644, 647, 1, 0, 0, 0, 645, 643, 1, 0, 0, 0, 645, 646, 1, 0, 0, 0, 646, 648, 1, 0, 0, 0, 647, 645, 1, 0, 0, 0, 648, 649, 6, 95, 0, 0, 649, 192, 1, 0, 0, 0, 650, 654, 5, 35, 0, 0, 651, 653, 8, 14, 0, 0, 652, 651, 1, 0, 0, 0, 653, 656, 1, 0, 0, 0, 654, 652, 1, 0, 0, 0, 654, 655, 1, 0, 0, 0, 655, 657, 1, 0, 0, 0, 656, 654, 1, 0, 0, 0, 657, 658, 6, 96, 0, 0, 658, 194, 1, 0, 0, 0, 37, 0, 443, 445, 457, 463, 470, 477, 491, 496, 502, 508, 515, 517, 521, 526, 528, 531, 536, 540, 545, 548, 550, 559, 563, 568, 576, 579, 587, 591, 598, 607, 612, 618, 621, 631, 645, 654, 1, 0, 1, 0] \ No newline at end of file diff --git a/zaplangLexer.py b/zaplangLexer.py new file mode 100644 index 0000000..6b4c848 --- /dev/null +++ b/zaplangLexer.py @@ -0,0 +1,405 @@ +# Generated from zaplangLexer.g4 by ANTLR 4.13.2 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + + +def serializedATN(): + return [ + 4,0,78,659,6,-1,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5, + 2,6,7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2, + 13,7,13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7, + 19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2, + 26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7, + 32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2, + 39,7,39,2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7, + 45,2,46,7,46,2,47,7,47,2,48,7,48,2,49,7,49,2,50,7,50,2,51,7,51,2, + 52,7,52,2,53,7,53,2,54,7,54,2,55,7,55,2,56,7,56,2,57,7,57,2,58,7, + 58,2,59,7,59,2,60,7,60,2,61,7,61,2,62,7,62,2,63,7,63,2,64,7,64,2, + 65,7,65,2,66,7,66,2,67,7,67,2,68,7,68,2,69,7,69,2,70,7,70,2,71,7, + 71,2,72,7,72,2,73,7,73,2,74,7,74,2,75,7,75,2,76,7,76,2,77,7,77,2, + 78,7,78,2,79,7,79,2,80,7,80,2,81,7,81,2,82,7,82,2,83,7,83,2,84,7, + 84,2,85,7,85,2,86,7,86,2,87,7,87,2,88,7,88,2,89,7,89,2,90,7,90,2, + 91,7,91,2,92,7,92,2,93,7,93,2,94,7,94,2,95,7,95,2,96,7,96,1,0,1, + 0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,3,1,3,1,3,1,3,1, + 3,1,4,1,4,1,4,1,4,1,4,1,4,1,5,1,5,1,5,1,5,1,5,1,5,1,5,1,6,1,6,1, + 6,1,6,1,6,1,6,1,7,1,7,1,7,1,7,1,7,1,7,1,8,1,8,1,8,1,8,1,8,1,9,1, + 9,1,9,1,9,1,9,1,10,1,10,1,10,1,10,1,10,1,10,1,11,1,11,1,11,1,11, + 1,11,1,12,1,12,1,12,1,12,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,15, + 1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,1,17,1,17, + 1,17,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,18,1,18, + 1,18,1,18,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,19,1,20, + 1,20,1,20,1,21,1,21,1,21,1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,22, + 1,22,1,22,1,22,1,22,1,23,1,23,1,24,1,24,1,25,1,25,1,26,1,26,1,27, + 1,27,1,28,1,28,1,29,1,29,1,30,1,30,1,30,1,31,1,31,1,32,1,32,1,32, + 1,33,1,33,1,34,1,34,1,34,1,35,1,35,1,36,1,36,1,36,1,37,1,37,1,38, + 1,38,1,39,1,39,1,40,1,40,1,41,1,41,1,42,1,42,1,42,1,43,1,43,1,43, + 1,44,1,44,1,45,1,45,1,46,1,46,1,46,1,47,1,47,1,47,1,48,1,48,1,49, + 1,49,1,50,1,50,1,51,1,51,1,52,1,52,1,53,1,53,1,54,1,54,1,54,1,55, + 1,55,1,55,1,56,1,56,1,56,1,57,1,57,1,57,1,58,1,58,1,58,1,59,1,59, + 1,59,1,60,1,60,1,60,1,61,1,61,1,61,1,61,1,62,1,62,1,62,1,62,1,63, + 1,63,1,63,1,64,1,64,1,64,1,65,1,65,1,65,1,66,1,66,1,66,1,67,1,67, + 1,68,1,68,1,68,5,68,444,8,68,10,68,12,68,447,9,68,1,69,1,69,1,70, + 1,70,1,71,1,71,1,72,1,72,1,72,3,72,458,8,72,1,73,1,73,5,73,462,8, + 73,10,73,12,73,465,9,73,1,74,1,74,5,74,469,8,74,10,74,12,74,472, + 9,74,1,75,1,75,4,75,476,8,75,11,75,12,75,477,1,76,1,76,1,76,1,77, + 1,77,1,78,1,78,1,79,1,79,1,80,4,80,490,8,80,11,80,12,80,491,1,81, + 4,81,495,8,81,11,81,12,81,496,1,81,1,81,5,81,501,8,81,10,81,12,81, + 504,9,81,1,81,5,81,507,8,81,10,81,12,81,510,9,81,1,81,1,81,4,81, + 514,8,81,11,81,12,81,515,3,81,518,8,81,1,81,1,81,3,81,522,8,81,1, + 81,4,81,525,8,81,11,81,12,81,526,3,81,529,8,81,1,81,3,81,532,8,81, + 1,81,4,81,535,8,81,11,81,12,81,536,1,81,1,81,3,81,541,8,81,1,81, + 4,81,544,8,81,11,81,12,81,545,1,81,3,81,549,8,81,3,81,551,8,81,1, + 82,1,82,1,82,1,82,1,83,4,83,558,8,83,11,83,12,83,559,1,84,1,84,3, + 84,564,8,84,1,85,1,85,1,85,3,85,569,8,85,1,86,1,86,1,86,1,87,1,87, + 1,87,3,87,577,8,87,1,87,3,87,580,8,87,1,88,1,88,1,88,1,88,4,88,586, + 8,88,11,88,12,88,587,1,89,1,89,3,89,592,8,89,1,89,1,89,1,90,4,90, + 597,8,90,11,90,12,90,598,1,91,1,91,1,91,1,91,1,91,1,91,1,91,3,91, + 608,8,91,1,92,4,92,611,8,92,11,92,12,92,612,1,92,1,92,1,93,1,93, + 3,93,619,8,93,1,93,3,93,622,8,93,1,93,1,93,1,94,1,94,1,94,1,94,5, + 94,630,8,94,10,94,12,94,633,9,94,1,94,1,94,1,94,1,94,1,94,1,95,1, + 95,1,95,1,95,5,95,644,8,95,10,95,12,95,647,9,95,1,95,1,95,1,96,1, + 96,5,96,653,8,96,10,96,12,96,656,9,96,1,96,1,96,1,631,0,97,1,1,3, + 2,5,3,7,4,9,5,11,6,13,7,15,8,17,9,19,10,21,11,23,12,25,13,27,14, + 29,15,31,16,33,17,35,18,37,19,39,20,41,21,43,22,45,23,47,24,49,25, + 51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,33,67,34,69,35,71,36, + 73,37,75,38,77,39,79,40,81,41,83,42,85,43,87,44,89,45,91,46,93,47, + 95,48,97,49,99,50,101,51,103,52,105,53,107,54,109,55,111,56,113, + 57,115,58,117,59,119,60,121,61,123,62,125,63,127,64,129,65,131,66, + 133,67,135,68,137,69,139,0,141,0,143,0,145,70,147,0,149,0,151,0, + 153,0,155,0,157,0,159,0,161,0,163,71,165,72,167,0,169,0,171,0,173, + 0,175,0,177,0,179,73,181,0,183,0,185,74,187,75,189,76,191,77,193, + 78,1,0,15,3,0,65,90,95,95,97,122,1,0,48,57,2,0,88,88,120,120,1,0, + 49,57,1,0,48,55,3,0,48,57,65,70,97,102,4,0,76,76,85,85,108,108,117, + 117,2,0,69,69,101,101,2,0,43,43,45,45,4,0,68,68,70,70,100,100,102, + 102,4,0,10,10,13,13,39,39,92,92,10,0,34,34,39,39,63,63,92,92,97, + 98,102,102,110,110,114,114,116,116,118,118,4,0,10,10,13,13,34,34, + 92,92,2,0,9,9,32,32,2,0,10,10,13,13,679,0,1,1,0,0,0,0,3,1,0,0,0, + 0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,0,0, + 15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0, + 25,1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0, + 35,1,0,0,0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0, + 45,1,0,0,0,0,47,1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0, + 55,1,0,0,0,0,57,1,0,0,0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0, + 65,1,0,0,0,0,67,1,0,0,0,0,69,1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0, + 75,1,0,0,0,0,77,1,0,0,0,0,79,1,0,0,0,0,81,1,0,0,0,0,83,1,0,0,0,0, + 85,1,0,0,0,0,87,1,0,0,0,0,89,1,0,0,0,0,91,1,0,0,0,0,93,1,0,0,0,0, + 95,1,0,0,0,0,97,1,0,0,0,0,99,1,0,0,0,0,101,1,0,0,0,0,103,1,0,0,0, + 0,105,1,0,0,0,0,107,1,0,0,0,0,109,1,0,0,0,0,111,1,0,0,0,0,113,1, + 0,0,0,0,115,1,0,0,0,0,117,1,0,0,0,0,119,1,0,0,0,0,121,1,0,0,0,0, + 123,1,0,0,0,0,125,1,0,0,0,0,127,1,0,0,0,0,129,1,0,0,0,0,131,1,0, + 0,0,0,133,1,0,0,0,0,135,1,0,0,0,0,137,1,0,0,0,0,145,1,0,0,0,0,163, + 1,0,0,0,0,165,1,0,0,0,0,179,1,0,0,0,0,185,1,0,0,0,0,187,1,0,0,0, + 0,189,1,0,0,0,0,191,1,0,0,0,0,193,1,0,0,0,1,195,1,0,0,0,3,199,1, + 0,0,0,5,204,1,0,0,0,7,208,1,0,0,0,9,213,1,0,0,0,11,219,1,0,0,0,13, + 226,1,0,0,0,15,232,1,0,0,0,17,238,1,0,0,0,19,243,1,0,0,0,21,248, + 1,0,0,0,23,254,1,0,0,0,25,259,1,0,0,0,27,263,1,0,0,0,29,266,1,0, + 0,0,31,270,1,0,0,0,33,279,1,0,0,0,35,282,1,0,0,0,37,290,1,0,0,0, + 39,299,1,0,0,0,41,309,1,0,0,0,43,312,1,0,0,0,45,318,1,0,0,0,47,327, + 1,0,0,0,49,329,1,0,0,0,51,331,1,0,0,0,53,333,1,0,0,0,55,335,1,0, + 0,0,57,337,1,0,0,0,59,339,1,0,0,0,61,341,1,0,0,0,63,344,1,0,0,0, + 65,346,1,0,0,0,67,349,1,0,0,0,69,351,1,0,0,0,71,354,1,0,0,0,73,356, + 1,0,0,0,75,359,1,0,0,0,77,361,1,0,0,0,79,363,1,0,0,0,81,365,1,0, + 0,0,83,367,1,0,0,0,85,369,1,0,0,0,87,372,1,0,0,0,89,375,1,0,0,0, + 91,377,1,0,0,0,93,379,1,0,0,0,95,382,1,0,0,0,97,385,1,0,0,0,99,387, + 1,0,0,0,101,389,1,0,0,0,103,391,1,0,0,0,105,393,1,0,0,0,107,395, + 1,0,0,0,109,397,1,0,0,0,111,400,1,0,0,0,113,403,1,0,0,0,115,406, + 1,0,0,0,117,409,1,0,0,0,119,412,1,0,0,0,121,415,1,0,0,0,123,418, + 1,0,0,0,125,422,1,0,0,0,127,426,1,0,0,0,129,429,1,0,0,0,131,432, + 1,0,0,0,133,435,1,0,0,0,135,438,1,0,0,0,137,440,1,0,0,0,139,448, + 1,0,0,0,141,450,1,0,0,0,143,452,1,0,0,0,145,457,1,0,0,0,147,459, + 1,0,0,0,149,466,1,0,0,0,151,473,1,0,0,0,153,479,1,0,0,0,155,482, + 1,0,0,0,157,484,1,0,0,0,159,486,1,0,0,0,161,489,1,0,0,0,163,550, + 1,0,0,0,165,552,1,0,0,0,167,557,1,0,0,0,169,563,1,0,0,0,171,568, + 1,0,0,0,173,570,1,0,0,0,175,573,1,0,0,0,177,581,1,0,0,0,179,589, + 1,0,0,0,181,596,1,0,0,0,183,607,1,0,0,0,185,610,1,0,0,0,187,621, + 1,0,0,0,189,625,1,0,0,0,191,639,1,0,0,0,193,650,1,0,0,0,195,196, + 5,98,0,0,196,197,5,117,0,0,197,198,5,108,0,0,198,2,1,0,0,0,199,200, + 5,102,0,0,200,201,5,117,0,0,201,202,5,110,0,0,202,203,5,99,0,0,203, + 4,1,0,0,0,204,205,5,102,0,0,205,206,5,105,0,0,206,207,5,110,0,0, + 207,6,1,0,0,0,208,209,5,99,0,0,209,210,5,97,0,0,210,211,5,115,0, + 0,211,212,5,111,0,0,212,8,1,0,0,0,213,214,5,99,0,0,214,215,5,97, + 0,0,215,216,5,114,0,0,216,217,5,97,0,0,217,218,5,99,0,0,218,10,1, + 0,0,0,219,220,5,112,0,0,220,221,5,111,0,0,221,222,5,114,0,0,222, + 223,5,100,0,0,223,224,5,101,0,0,224,225,5,102,0,0,225,12,1,0,0,0, + 226,227,5,104,0,0,227,228,5,97,0,0,228,229,5,99,0,0,229,230,5,101, + 0,0,230,231,5,114,0,0,231,14,1,0,0,0,232,233,5,100,0,0,233,234,5, + 111,0,0,234,235,5,98,0,0,235,236,5,108,0,0,236,237,5,101,0,0,237, + 16,1,0,0,0,238,239,5,115,0,0,239,240,5,105,0,0,240,241,5,110,0,0, + 241,242,5,111,0,0,242,18,1,0,0,0,243,244,5,101,0,0,244,245,5,110, + 0,0,245,246,5,117,0,0,246,247,5,109,0,0,247,20,1,0,0,0,248,249,5, + 102,0,0,249,250,5,97,0,0,250,251,5,108,0,0,251,252,5,115,0,0,252, + 253,5,111,0,0,253,22,1,0,0,0,254,255,5,102,0,0,255,256,5,108,0,0, + 256,257,5,111,0,0,257,258,5,116,0,0,258,24,1,0,0,0,259,260,5,112, + 0,0,260,261,5,111,0,0,261,262,5,114,0,0,262,26,1,0,0,0,263,264,5, + 115,0,0,264,265,5,105,0,0,265,28,1,0,0,0,266,267,5,69,0,0,267,268, + 5,110,0,0,268,269,5,116,0,0,269,30,1,0,0,0,270,271,5,114,0,0,271, + 272,5,101,0,0,272,273,5,116,0,0,273,274,5,111,0,0,274,275,5,114, + 0,0,275,276,5,110,0,0,276,277,5,97,0,0,277,278,5,114,0,0,278,32, + 1,0,0,0,279,280,5,99,0,0,280,281,5,102,0,0,281,34,1,0,0,0,282,283, + 5,101,0,0,283,284,5,115,0,0,284,285,5,116,0,0,285,286,5,114,0,0, + 286,287,5,117,0,0,287,288,5,99,0,0,288,289,5,116,0,0,289,36,1,0, + 0,0,290,291,5,105,0,0,291,292,5,110,0,0,292,293,5,116,0,0,293,294, + 5,101,0,0,294,295,5,114,0,0,295,296,5,114,0,0,296,297,5,117,0,0, + 297,298,5,112,0,0,298,38,1,0,0,0,299,300,5,118,0,0,300,301,5,101, + 0,0,301,302,5,114,0,0,302,303,5,100,0,0,303,304,5,97,0,0,304,305, + 5,100,0,0,305,306,5,101,0,0,306,307,5,114,0,0,307,308,5,111,0,0, + 308,40,1,0,0,0,309,310,5,115,0,0,310,311,5,102,0,0,311,42,1,0,0, + 0,312,313,5,118,0,0,313,314,5,97,0,0,314,315,5,99,0,0,315,316,5, + 105,0,0,316,317,5,111,0,0,317,44,1,0,0,0,318,319,5,109,0,0,319,320, + 5,105,0,0,320,321,5,101,0,0,321,322,5,110,0,0,322,323,5,116,0,0, + 323,324,5,114,0,0,324,325,5,97,0,0,325,326,5,115,0,0,326,46,1,0, + 0,0,327,328,5,40,0,0,328,48,1,0,0,0,329,330,5,41,0,0,330,50,1,0, + 0,0,331,332,5,91,0,0,332,52,1,0,0,0,333,334,5,93,0,0,334,54,1,0, + 0,0,335,336,5,123,0,0,336,56,1,0,0,0,337,338,5,125,0,0,338,58,1, + 0,0,0,339,340,5,60,0,0,340,60,1,0,0,0,341,342,5,60,0,0,342,343,5, + 61,0,0,343,62,1,0,0,0,344,345,5,62,0,0,345,64,1,0,0,0,346,347,5, + 62,0,0,347,348,5,61,0,0,348,66,1,0,0,0,349,350,5,43,0,0,350,68,1, + 0,0,0,351,352,5,43,0,0,352,353,5,43,0,0,353,70,1,0,0,0,354,355,5, + 45,0,0,355,72,1,0,0,0,356,357,5,45,0,0,357,358,5,45,0,0,358,74,1, + 0,0,0,359,360,5,42,0,0,360,76,1,0,0,0,361,362,5,47,0,0,362,78,1, + 0,0,0,363,364,5,37,0,0,364,80,1,0,0,0,365,366,5,38,0,0,366,82,1, + 0,0,0,367,368,5,124,0,0,368,84,1,0,0,0,369,370,5,60,0,0,370,371, + 5,60,0,0,371,86,1,0,0,0,372,373,5,62,0,0,373,374,5,62,0,0,374,88, + 1,0,0,0,375,376,5,94,0,0,376,90,1,0,0,0,377,378,5,126,0,0,378,92, + 1,0,0,0,379,380,5,38,0,0,380,381,5,38,0,0,381,94,1,0,0,0,382,383, + 5,124,0,0,383,384,5,124,0,0,384,96,1,0,0,0,385,386,5,33,0,0,386, + 98,1,0,0,0,387,388,5,63,0,0,388,100,1,0,0,0,389,390,5,58,0,0,390, + 102,1,0,0,0,391,392,5,59,0,0,392,104,1,0,0,0,393,394,5,44,0,0,394, + 106,1,0,0,0,395,396,5,61,0,0,396,108,1,0,0,0,397,398,5,42,0,0,398, + 399,5,61,0,0,399,110,1,0,0,0,400,401,5,47,0,0,401,402,5,61,0,0,402, + 112,1,0,0,0,403,404,5,37,0,0,404,405,5,61,0,0,405,114,1,0,0,0,406, + 407,5,43,0,0,407,408,5,61,0,0,408,116,1,0,0,0,409,410,5,45,0,0,410, + 411,5,61,0,0,411,118,1,0,0,0,412,413,5,38,0,0,413,414,5,61,0,0,414, + 120,1,0,0,0,415,416,5,124,0,0,416,417,5,61,0,0,417,122,1,0,0,0,418, + 419,5,60,0,0,419,420,5,60,0,0,420,421,5,61,0,0,421,124,1,0,0,0,422, + 423,5,62,0,0,423,424,5,62,0,0,424,425,5,61,0,0,425,126,1,0,0,0,426, + 427,5,94,0,0,427,428,5,61,0,0,428,128,1,0,0,0,429,430,5,61,0,0,430, + 431,5,61,0,0,431,130,1,0,0,0,432,433,5,33,0,0,433,434,5,61,0,0,434, + 132,1,0,0,0,435,436,5,45,0,0,436,437,5,62,0,0,437,134,1,0,0,0,438, + 439,5,46,0,0,439,136,1,0,0,0,440,445,3,139,69,0,441,444,3,139,69, + 0,442,444,3,143,71,0,443,441,1,0,0,0,443,442,1,0,0,0,444,447,1,0, + 0,0,445,443,1,0,0,0,445,446,1,0,0,0,446,138,1,0,0,0,447,445,1,0, + 0,0,448,449,3,141,70,0,449,140,1,0,0,0,450,451,7,0,0,0,451,142,1, + 0,0,0,452,453,7,1,0,0,453,144,1,0,0,0,454,458,3,147,73,0,455,458, + 3,149,74,0,456,458,3,151,75,0,457,454,1,0,0,0,457,455,1,0,0,0,457, + 456,1,0,0,0,458,146,1,0,0,0,459,463,3,155,77,0,460,462,3,143,71, + 0,461,460,1,0,0,0,462,465,1,0,0,0,463,461,1,0,0,0,463,464,1,0,0, + 0,464,148,1,0,0,0,465,463,1,0,0,0,466,470,5,48,0,0,467,469,3,157, + 78,0,468,467,1,0,0,0,469,472,1,0,0,0,470,468,1,0,0,0,470,471,1,0, + 0,0,471,150,1,0,0,0,472,470,1,0,0,0,473,475,3,153,76,0,474,476,3, + 159,79,0,475,474,1,0,0,0,476,477,1,0,0,0,477,475,1,0,0,0,477,478, + 1,0,0,0,478,152,1,0,0,0,479,480,5,48,0,0,480,481,7,2,0,0,481,154, + 1,0,0,0,482,483,7,3,0,0,483,156,1,0,0,0,484,485,7,4,0,0,485,158, + 1,0,0,0,486,487,7,5,0,0,487,160,1,0,0,0,488,490,7,6,0,0,489,488, + 1,0,0,0,490,491,1,0,0,0,491,489,1,0,0,0,491,492,1,0,0,0,492,162, + 1,0,0,0,493,495,3,143,71,0,494,493,1,0,0,0,495,496,1,0,0,0,496,494, + 1,0,0,0,496,497,1,0,0,0,497,498,1,0,0,0,498,502,5,46,0,0,499,501, + 3,143,71,0,500,499,1,0,0,0,501,504,1,0,0,0,502,500,1,0,0,0,502,503, + 1,0,0,0,503,518,1,0,0,0,504,502,1,0,0,0,505,507,3,143,71,0,506,505, + 1,0,0,0,507,510,1,0,0,0,508,506,1,0,0,0,508,509,1,0,0,0,509,511, + 1,0,0,0,510,508,1,0,0,0,511,513,5,46,0,0,512,514,3,143,71,0,513, + 512,1,0,0,0,514,515,1,0,0,0,515,513,1,0,0,0,515,516,1,0,0,0,516, + 518,1,0,0,0,517,494,1,0,0,0,517,508,1,0,0,0,518,528,1,0,0,0,519, + 521,7,7,0,0,520,522,7,8,0,0,521,520,1,0,0,0,521,522,1,0,0,0,522, + 524,1,0,0,0,523,525,3,143,71,0,524,523,1,0,0,0,525,526,1,0,0,0,526, + 524,1,0,0,0,526,527,1,0,0,0,527,529,1,0,0,0,528,519,1,0,0,0,528, + 529,1,0,0,0,529,531,1,0,0,0,530,532,7,9,0,0,531,530,1,0,0,0,531, + 532,1,0,0,0,532,551,1,0,0,0,533,535,3,143,71,0,534,533,1,0,0,0,535, + 536,1,0,0,0,536,534,1,0,0,0,536,537,1,0,0,0,537,538,1,0,0,0,538, + 540,7,7,0,0,539,541,7,8,0,0,540,539,1,0,0,0,540,541,1,0,0,0,541, + 543,1,0,0,0,542,544,3,143,71,0,543,542,1,0,0,0,544,545,1,0,0,0,545, + 543,1,0,0,0,545,546,1,0,0,0,546,548,1,0,0,0,547,549,7,9,0,0,548, + 547,1,0,0,0,548,549,1,0,0,0,549,551,1,0,0,0,550,517,1,0,0,0,550, + 534,1,0,0,0,551,164,1,0,0,0,552,553,5,39,0,0,553,554,3,167,83,0, + 554,555,5,39,0,0,555,166,1,0,0,0,556,558,3,169,84,0,557,556,1,0, + 0,0,558,559,1,0,0,0,559,557,1,0,0,0,559,560,1,0,0,0,560,168,1,0, + 0,0,561,564,8,10,0,0,562,564,3,171,85,0,563,561,1,0,0,0,563,562, + 1,0,0,0,564,170,1,0,0,0,565,569,3,173,86,0,566,569,3,175,87,0,567, + 569,3,177,88,0,568,565,1,0,0,0,568,566,1,0,0,0,568,567,1,0,0,0,569, + 172,1,0,0,0,570,571,5,92,0,0,571,572,7,11,0,0,572,174,1,0,0,0,573, + 574,5,92,0,0,574,576,3,157,78,0,575,577,3,157,78,0,576,575,1,0,0, + 0,576,577,1,0,0,0,577,579,1,0,0,0,578,580,3,157,78,0,579,578,1,0, + 0,0,579,580,1,0,0,0,580,176,1,0,0,0,581,582,5,92,0,0,582,583,5,120, + 0,0,583,585,1,0,0,0,584,586,3,159,79,0,585,584,1,0,0,0,586,587,1, + 0,0,0,587,585,1,0,0,0,587,588,1,0,0,0,588,178,1,0,0,0,589,591,5, + 34,0,0,590,592,3,181,90,0,591,590,1,0,0,0,591,592,1,0,0,0,592,593, + 1,0,0,0,593,594,5,34,0,0,594,180,1,0,0,0,595,597,3,183,91,0,596, + 595,1,0,0,0,597,598,1,0,0,0,598,596,1,0,0,0,598,599,1,0,0,0,599, + 182,1,0,0,0,600,608,8,12,0,0,601,608,3,171,85,0,602,603,5,92,0,0, + 603,608,5,10,0,0,604,605,5,92,0,0,605,606,5,13,0,0,606,608,5,10, + 0,0,607,600,1,0,0,0,607,601,1,0,0,0,607,602,1,0,0,0,607,604,1,0, + 0,0,608,184,1,0,0,0,609,611,7,13,0,0,610,609,1,0,0,0,611,612,1,0, + 0,0,612,610,1,0,0,0,612,613,1,0,0,0,613,614,1,0,0,0,614,615,6,92, + 0,0,615,186,1,0,0,0,616,618,5,13,0,0,617,619,5,10,0,0,618,617,1, + 0,0,0,618,619,1,0,0,0,619,622,1,0,0,0,620,622,5,10,0,0,621,616,1, + 0,0,0,621,620,1,0,0,0,622,623,1,0,0,0,623,624,6,93,0,0,624,188,1, + 0,0,0,625,626,5,47,0,0,626,627,5,42,0,0,627,631,1,0,0,0,628,630, + 9,0,0,0,629,628,1,0,0,0,630,633,1,0,0,0,631,632,1,0,0,0,631,629, + 1,0,0,0,632,634,1,0,0,0,633,631,1,0,0,0,634,635,5,42,0,0,635,636, + 5,47,0,0,636,637,1,0,0,0,637,638,6,94,0,0,638,190,1,0,0,0,639,640, + 5,47,0,0,640,641,5,47,0,0,641,645,1,0,0,0,642,644,8,14,0,0,643,642, + 1,0,0,0,644,647,1,0,0,0,645,643,1,0,0,0,645,646,1,0,0,0,646,648, + 1,0,0,0,647,645,1,0,0,0,648,649,6,95,0,0,649,192,1,0,0,0,650,654, + 5,35,0,0,651,653,8,14,0,0,652,651,1,0,0,0,653,656,1,0,0,0,654,652, + 1,0,0,0,654,655,1,0,0,0,655,657,1,0,0,0,656,654,1,0,0,0,657,658, + 6,96,0,0,658,194,1,0,0,0,37,0,443,445,457,463,470,477,491,496,502, + 508,515,517,521,526,528,531,536,540,545,548,550,559,563,568,576, + 579,587,591,598,607,612,618,621,631,645,654,1,0,1,0 + ] + +class zaplangLexer(Lexer): + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + Bul = 1 + Func = 2 + Fin = 3 + Caso = 4 + Carac = 5 + Pordef = 6 + Hacer = 7 + Doble = 8 + Sino = 9 + Enum = 10 + Falso = 11 + Flot = 12 + Por = 13 + Si = 14 + Ent = 15 + Retornar = 16 + ConFirma = 17 + Estruct = 18 + Interrup = 19 + Verdadero = 20 + SinFirma = 21 + Vacio = 22 + Mientras = 23 + ParenIzq = 24 + ParenDer = 25 + CorcheteIzq = 26 + CorcheteDer = 27 + LlaveIzq = 28 + LlaveDer = 29 + MenorQue = 30 + MenorOIgualQue = 31 + MayorQue = 32 + MayorOIgualQue = 33 + Mas = 34 + MasMas = 35 + Menos = 36 + MenosMenos = 37 + Estrella = 38 + Div = 39 + Mod = 40 + Y = 41 + O = 42 + DesplazIzq = 43 + DesplazDer = 44 + Xor = 45 + Complemento = 46 + YY = 47 + OO = 48 + Not = 49 + Pregunta = 50 + DosPuntos = 51 + PuntoYComa = 52 + Coma = 53 + Asignar = 54 + EstrellaAsignacion = 55 + DivAsignacion = 56 + ModAsignacion = 57 + MasAsignacion = 58 + MenosAsignacion = 59 + YAsignacion = 60 + OAsignacion = 61 + DesplazIzqAsignacion = 62 + DesplazDerAsignacion = 63 + XorAsignacion = 64 + Igual = 65 + Diferente = 66 + Flecha = 67 + Punto = 68 + Identificador = 69 + ConstanteEntera = 70 + ConstanteFlotante = 71 + ConstanteCaracteres = 72 + CadenaLiteral = 73 + Whitespace = 74 + Newline = 75 + BlockComment = 76 + LineComment = 77 + LineCommentHash = 78 + + channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] + + modeNames = [ "DEFAULT_MODE" ] + + literalNames = [ "", + "'bul'", "'func'", "'fin'", "'caso'", "'carac'", "'pordef'", + "'hacer'", "'doble'", "'sino'", "'enum'", "'falso'", "'flot'", + "'por'", "'si'", "'Ent'", "'retornar'", "'cf'", "'estruct'", + "'interrup'", "'verdadero'", "'sf'", "'vacio'", "'mientras'", + "'('", "')'", "'['", "']'", "'{'", "'}'", "'<'", "'<='", "'>'", + "'>='", "'+'", "'++'", "'-'", "'--'", "'*'", "'/'", "'%'", "'&'", + "'|'", "'<<'", "'>>'", "'^'", "'~'", "'&&'", "'||'", "'!'", + "'?'", "':'", "';'", "','", "'='", "'*='", "'/='", "'%='", "'+='", + "'-='", "'&='", "'|='", "'<<='", "'>>='", "'^='", "'=='", "'!='", + "'->'", "'.'" ] + + symbolicNames = [ "", + "Bul", "Func", "Fin", "Caso", "Carac", "Pordef", "Hacer", "Doble", + "Sino", "Enum", "Falso", "Flot", "Por", "Si", "Ent", "Retornar", + "ConFirma", "Estruct", "Interrup", "Verdadero", "SinFirma", + "Vacio", "Mientras", "ParenIzq", "ParenDer", "CorcheteIzq", + "CorcheteDer", "LlaveIzq", "LlaveDer", "MenorQue", "MenorOIgualQue", + "MayorQue", "MayorOIgualQue", "Mas", "MasMas", "Menos", "MenosMenos", + "Estrella", "Div", "Mod", "Y", "O", "DesplazIzq", "DesplazDer", + "Xor", "Complemento", "YY", "OO", "Not", "Pregunta", "DosPuntos", + "PuntoYComa", "Coma", "Asignar", "EstrellaAsignacion", "DivAsignacion", + "ModAsignacion", "MasAsignacion", "MenosAsignacion", "YAsignacion", + "OAsignacion", "DesplazIzqAsignacion", "DesplazDerAsignacion", + "XorAsignacion", "Igual", "Diferente", "Flecha", "Punto", "Identificador", + "ConstanteEntera", "ConstanteFlotante", "ConstanteCaracteres", + "CadenaLiteral", "Whitespace", "Newline", "BlockComment", "LineComment", + "LineCommentHash" ] + + ruleNames = [ "Bul", "Func", "Fin", "Caso", "Carac", "Pordef", "Hacer", + "Doble", "Sino", "Enum", "Falso", "Flot", "Por", "Si", + "Ent", "Retornar", "ConFirma", "Estruct", "Interrup", + "Verdadero", "SinFirma", "Vacio", "Mientras", "ParenIzq", + "ParenDer", "CorcheteIzq", "CorcheteDer", "LlaveIzq", + "LlaveDer", "MenorQue", "MenorOIgualQue", "MayorQue", + "MayorOIgualQue", "Mas", "MasMas", "Menos", "MenosMenos", + "Estrella", "Div", "Mod", "Y", "O", "DesplazIzq", "DesplazDer", + "Xor", "Complemento", "YY", "OO", "Not", "Pregunta", "DosPuntos", + "PuntoYComa", "Coma", "Asignar", "EstrellaAsignacion", + "DivAsignacion", "ModAsignacion", "MasAsignacion", "MenosAsignacion", + "YAsignacion", "OAsignacion", "DesplazIzqAsignacion", + "DesplazDerAsignacion", "XorAsignacion", "Igual", "Diferente", + "Flecha", "Punto", "Identificador", "IdentificadorSindigito", + "Nodigito", "Digito", "ConstanteEntera", "ConstanteDecimal", + "ConstanteOctal", "HexaConstanteDecimal", "PrefijoHexadecimal", + "DigitoNoCero", "DigitoOctal", "DigitoHexadecimal", "SufijoEntero", + "ConstanteFlotante", "ConstanteCaracteres", "CCharSequence", + "CChar", "SecuenciaEscape", "SecuenciaEscapeSimple", "SecuenciaEscapeOctal", + "SecuenciaEscapeHexadecimal", "CadenaLiteral", "SSecuenciaCaracteres", + "SCaracter", "Whitespace", "Newline", "BlockComment", + "LineComment", "LineCommentHash" ] + + grammarFileName = "zaplangLexer.g4" + + def __init__(self, input=None, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.2") + self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) + self._actions = None + self._predicates = None + + diff --git a/zaplangLexer.tokens b/zaplangLexer.tokens new file mode 100644 index 0000000..06a48c0 --- /dev/null +++ b/zaplangLexer.tokens @@ -0,0 +1,146 @@ +Bul=1 +Func=2 +Fin=3 +Caso=4 +Carac=5 +Pordef=6 +Hacer=7 +Doble=8 +Sino=9 +Enum=10 +Falso=11 +Flot=12 +Por=13 +Si=14 +Ent=15 +Retornar=16 +ConFirma=17 +Estruct=18 +Interrup=19 +Verdadero=20 +SinFirma=21 +Vacio=22 +Mientras=23 +ParenIzq=24 +ParenDer=25 +CorcheteIzq=26 +CorcheteDer=27 +LlaveIzq=28 +LlaveDer=29 +MenorQue=30 +MenorOIgualQue=31 +MayorQue=32 +MayorOIgualQue=33 +Mas=34 +MasMas=35 +Menos=36 +MenosMenos=37 +Estrella=38 +Div=39 +Mod=40 +Y=41 +O=42 +DesplazIzq=43 +DesplazDer=44 +Xor=45 +Complemento=46 +YY=47 +OO=48 +Not=49 +Pregunta=50 +DosPuntos=51 +PuntoYComa=52 +Coma=53 +Asignar=54 +EstrellaAsignacion=55 +DivAsignacion=56 +ModAsignacion=57 +MasAsignacion=58 +MenosAsignacion=59 +YAsignacion=60 +OAsignacion=61 +DesplazIzqAsignacion=62 +DesplazDerAsignacion=63 +XorAsignacion=64 +Igual=65 +Diferente=66 +Flecha=67 +Punto=68 +Identificador=69 +ConstanteEntera=70 +ConstanteFlotante=71 +ConstanteCaracteres=72 +CadenaLiteral=73 +Whitespace=74 +Newline=75 +BlockComment=76 +LineComment=77 +LineCommentHash=78 +'bul'=1 +'func'=2 +'fin'=3 +'caso'=4 +'carac'=5 +'pordef'=6 +'hacer'=7 +'doble'=8 +'sino'=9 +'enum'=10 +'falso'=11 +'flot'=12 +'por'=13 +'si'=14 +'Ent'=15 +'retornar'=16 +'cf'=17 +'estruct'=18 +'interrup'=19 +'verdadero'=20 +'sf'=21 +'vacio'=22 +'mientras'=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 diff --git a/zaplangParser.g4 b/zaplangParser.g4 new file mode 100644 index 0000000..a266f08 --- /dev/null +++ b/zaplangParser.g4 @@ -0,0 +1,308 @@ +parser grammar zaplangParser; + +options { + tokenVocab = zaplangLexer; + language = Python3; +} + +// ============================================================================ +// PUNTO DE ENTRADA DEL PROGRAMA +// ============================================================================ + +unidadTraduccion + : declaracionExterna* + ; + +declaracionExterna + : declaracionFuncion + | declaracionVariable + | declaracionEstruct + | declaracionEnum + ; + +// ============================================================================ +// DECLARACIONES DE FUNCIONES +// ============================================================================ + +declaracionFuncion + : tipoRetorno identificadorFuncion + ParenIzq listaParametros? ParenDer + bloque + ; + +tipoRetorno + : especificadorTipo + | Vacio + ; + +identificadorFuncion + : Identificador + ; + +listaParametros + : declaracionParametro (Coma declaracionParametro)* + ; + +declaracionParametro + : especificadorTipo Identificador + | especificadorTipo Identificador CorcheteIzq ConstanteEntera CorcheteDer + ; + +// ============================================================================ +// ESPECIFICADORES DE TIPO +// ============================================================================ + +especificadorTipo + : tipoBasico (CorcheteIzq ConstanteEntera? CorcheteDer)* + | tipoEstructurado (CorcheteIzq ConstanteEntera? CorcheteDer)* + ; + +tipoBasico + : Ent + | Doble + | Flot + | Carac + | ConFirma + | SinFirma + | puntero + ; + +puntero + : Estrella + | Estrella Estrella + | Estrella Estrella Estrella + ; + +tipoEstructurado + : Estruct Identificador + | Enum Identificador + ; + +// ============================================================================ +// DECLARACIONES DE ESTRUCTURAS +// ============================================================================ + +declaracionEstruct + : Estruct Identificador LlaveIzq miembroEstruct* LlaveDer PuntoYComa + ; + +miembroEstruct + : especificadorTipo Identificador PuntoYComa + | especificadorTipo Identificador CorcheteIzq ConstanteEntera CorcheteDer PuntoYComa + ; + +// ============================================================================ +// DECLARACIONES DE ENUMERACIONES +// ============================================================================ + +declaracionEnum + : Enum Identificador LlaveIzq listaEnumeradores LlaveDer PuntoYComa + ; + +listaEnumeradores + : enumerador (Coma enumerador)* + ; + +enumerador + : Identificador + | Identificador Asignar ConstanteEntera + ; + +// ============================================================================ +// DECLARACIONES DE VARIABLES Y ASIGNACIONES +// ============================================================================ + +declaracionVariable + : especificadorTipo inicializadorVariable (Coma inicializadorVariable)* PuntoYComa + ; + +inicializadorVariable + : Identificador + | Identificador Asignar inicializador + | Identificador CorcheteIzq ConstanteEntera CorcheteDer + | Identificador CorcheteIzq ConstanteEntera CorcheteDer Asignar inicializadorArreglo + ; + +inicializador + : asignacionExpresion + ; + +inicializadorArreglo + : LlaveIzq listaInitializers? LlaveDer + ; + +listaInitializers + : asignacionExpresion (Coma asignacionExpresion)* + ; + +// ============================================================================ +// SENTENCIAS +// ============================================================================ + +sentencia + : sentenciaCompuesta + | sentenciaDeclaracion + | sentenciaExpresion + | sentenciaSeleccion + | sentenciaIteracion + | sentenciaSalto + ; + +sentenciaCompuesta + : LlaveIzq sentencia* LlaveDer + ; + +sentenciaDeclaracion + : declaracionVariable + ; + +sentenciaExpresion + : expresion PuntoYComa + | PuntoYComa + ; + +sentenciaSeleccion + : Si ParenIzq expresion ParenDer sentencia + | Si ParenIzq expresion ParenDer sentencia Sino sentencia + | Caso Bul LlaveIzq casoEtiqueta* etiquetaPorDef? LlaveDer + ; + +casoEtiqueta + : Caso constanteExpresion DosPuntos sentencia* + ; + +etiquetaPorDef + : Pordef DosPuntos sentencia* + ; + +sentenciaIteracion + : Mientras ParenIzq expresion ParenDer sentencia + | Por ParenIzq sentenciaExpresion? PuntoYComa expresion? PuntoYComa expresion? ParenDer sentencia + ; + +sentenciaSalto + : Retornar expresion? PuntoYComa + | Fin PuntoYComa + | Interrup PuntoYComa + ; + +bloque + : LlaveIzq declaracionVariable* sentencia* LlaveDer + | sentencia + ; + +// ============================================================================ +// EXPRESIONES +// ============================================================================ + +expresion + : asignacionExpresion + | expresion Coma asignacionExpresion + ; + +asignacionExpresion + : expresionCondicional + | expresionUnaria operadorAsignacion asignacionExpresion + ; + +operadorAsignacion + : Asignar + | MasAsignacion + | MenosAsignacion + | EstrellaAsignacion + | DivAsignacion + | ModAsignacion + | DesplazIzqAsignacion + | DesplazDerAsignacion + | YAsignacion + | XorAsignacion + | OAsignacion + ; + +expresionCondicional + : expresionLogicaO + | expresionLogicaO Pregunta expresion DosPuntos expresionCondicional + ; + +expresionLogicaO + : expresionLogicaY (OO expresionLogicaY)* + ; + +expresionLogicaY + : expresionIgualacion (YY expresionIgualacion)* + ; + +expresionIgualacion + : expresionRelacional ((Igual | Diferente) expresionRelacional)* + ; + +expresionRelacional + : expresionDesplazamiento ((MenorQue | MayorQue | MenorOIgualQue | MayorOIgualQue) expresionDesplazamiento)* + ; + +expresionDesplazamiento + : expresionAditiva ((DesplazIzq | DesplazDer) expresionAditiva)* + ; + +expresionAditiva + : expresionMultiplicativa ((Mas | Menos) expresionMultiplicativa)* + ; + +expresionMultiplicativa + : expresionUnaria ((Estrella | Div | Mod) expresionUnaria)* + ; + +expresionUnaria + : operadorUnario expresionUnaria + | expresionPostfija + ; + +operadorUnario + : Y + | Estrella + | Mas + | Menos + | Complemento + | Not + | MasMas + | MenosMenos + ; + +expresionPostfija + : expresionPrimaria + | expresionPostfija CorcheteIzq expresion CorcheteDer + | expresionPostfija ParenIzq listaArgumentos? ParenDer + | expresionPostfija Punto Identificador + | expresionPostfija Flecha Identificador + | expresionPostfija MasMas + | expresionPostfija MenosMenos + ; + +expresionPrimaria + : Identificador + | constanteExpresion + | CadenaLiteral + | ParenIzq expresion ParenDer + | ParenIzq especificadorTipo ParenDer expresionUnaria + ; + +constanteExpresion + : ConstanteEntera + | ConstanteFlotante + | ConstanteCaracteres + | Verdadero + | Falso + ; + +listaArgumentos + : asignacionExpresion (Coma asignacionExpresion)* + ; + +// ============================================================================ +// REGLAS AUXILIARES +// ============================================================================ + +// Palabra clave utilizada para marcar puntos de entrada opcionales +marcaPunto + : Bul + ; diff --git a/zaplangParser.interp b/zaplangParser.interp new file mode 100644 index 0000000..4633abe --- /dev/null +++ b/zaplangParser.interp @@ -0,0 +1,216 @@ +token literal names: +null +'bul' +'func' +'fin' +'caso' +'carac' +'pordef' +'hacer' +'doble' +'sino' +'enum' +'falso' +'flot' +'por' +'si' +'Ent' +'retornar' +'cf' +'estruct' +'interrup' +'verdadero' +'sf' +'vacio' +'mientras' +'(' +')' +'[' +']' +'{' +'}' +'<' +'<=' +'>' +'>=' +'+' +'++' +'-' +'--' +'*' +'/' +'%' +'&' +'|' +'<<' +'>>' +'^' +'~' +'&&' +'||' +'!' +'?' +':' +';' +',' +'=' +'*=' +'/=' +'%=' +'+=' +'-=' +'&=' +'|=' +'<<=' +'>>=' +'^=' +'==' +'!=' +'->' +'.' +null +null +null +null +null +null +null +null +null +null + +token symbolic names: +null +Bul +Func +Fin +Caso +Carac +Pordef +Hacer +Doble +Sino +Enum +Falso +Flot +Por +Si +Ent +Retornar +ConFirma +Estruct +Interrup +Verdadero +SinFirma +Vacio +Mientras +ParenIzq +ParenDer +CorcheteIzq +CorcheteDer +LlaveIzq +LlaveDer +MenorQue +MenorOIgualQue +MayorQue +MayorOIgualQue +Mas +MasMas +Menos +MenosMenos +Estrella +Div +Mod +Y +O +DesplazIzq +DesplazDer +Xor +Complemento +YY +OO +Not +Pregunta +DosPuntos +PuntoYComa +Coma +Asignar +EstrellaAsignacion +DivAsignacion +ModAsignacion +MasAsignacion +MenosAsignacion +YAsignacion +OAsignacion +DesplazIzqAsignacion +DesplazDerAsignacion +XorAsignacion +Igual +Diferente +Flecha +Punto +Identificador +ConstanteEntera +ConstanteFlotante +ConstanteCaracteres +CadenaLiteral +Whitespace +Newline +BlockComment +LineComment +LineCommentHash + +rule names: +unidadTraduccion +declaracionExterna +declaracionFuncion +tipoRetorno +identificadorFuncion +listaParametros +declaracionParametro +especificadorTipo +tipoBasico +puntero +tipoEstructurado +declaracionEstruct +miembroEstruct +declaracionEnum +listaEnumeradores +enumerador +declaracionVariable +inicializadorVariable +inicializador +inicializadorArreglo +listaInitializers +sentencia +sentenciaCompuesta +sentenciaDeclaracion +sentenciaExpresion +sentenciaSeleccion +casoEtiqueta +etiquetaPorDef +sentenciaIteracion +sentenciaSalto +bloque +expresion +asignacionExpresion +operadorAsignacion +expresionCondicional +expresionLogicaO +expresionLogicaY +expresionIgualacion +expresionRelacional +expresionDesplazamiento +expresionAditiva +expresionMultiplicativa +expresionUnaria +operadorUnario +expresionPostfija +expresionPrimaria +constanteExpresion +listaArgumentos +marcaPunto + + +atn: +[4, 1, 78, 551, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 2, 24, 7, 24, 2, 25, 7, 25, 2, 26, 7, 26, 2, 27, 7, 27, 2, 28, 7, 28, 2, 29, 7, 29, 2, 30, 7, 30, 2, 31, 7, 31, 2, 32, 7, 32, 2, 33, 7, 33, 2, 34, 7, 34, 2, 35, 7, 35, 2, 36, 7, 36, 2, 37, 7, 37, 2, 38, 7, 38, 2, 39, 7, 39, 2, 40, 7, 40, 2, 41, 7, 41, 2, 42, 7, 42, 2, 43, 7, 43, 2, 44, 7, 44, 2, 45, 7, 45, 2, 46, 7, 46, 2, 47, 7, 47, 2, 48, 7, 48, 1, 0, 5, 0, 100, 8, 0, 10, 0, 12, 0, 103, 9, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 109, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 115, 8, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 122, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 5, 5, 129, 8, 5, 10, 5, 12, 5, 132, 9, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 3, 6, 143, 8, 6, 1, 7, 1, 7, 1, 7, 3, 7, 148, 8, 7, 1, 7, 5, 7, 151, 8, 7, 10, 7, 12, 7, 154, 9, 7, 1, 7, 1, 7, 1, 7, 3, 7, 159, 8, 7, 1, 7, 5, 7, 162, 8, 7, 10, 7, 12, 7, 165, 9, 7, 3, 7, 167, 8, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 3, 8, 176, 8, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 3, 9, 184, 8, 9, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 190, 8, 10, 1, 11, 1, 11, 1, 11, 1, 11, 5, 11, 196, 8, 11, 10, 11, 12, 11, 199, 9, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 1, 12, 3, 12, 215, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 5, 14, 227, 8, 14, 10, 14, 12, 14, 230, 9, 14, 1, 15, 1, 15, 1, 15, 1, 15, 3, 15, 236, 8, 15, 1, 16, 1, 16, 1, 16, 1, 16, 5, 16, 242, 8, 16, 10, 16, 12, 16, 245, 9, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 1, 17, 3, 17, 263, 8, 17, 1, 18, 1, 18, 1, 19, 1, 19, 3, 19, 269, 8, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 5, 20, 276, 8, 20, 10, 20, 12, 20, 279, 9, 20, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 3, 21, 287, 8, 21, 1, 22, 1, 22, 5, 22, 291, 8, 22, 10, 22, 12, 22, 294, 9, 22, 1, 22, 1, 22, 1, 23, 1, 23, 1, 24, 1, 24, 1, 24, 1, 24, 3, 24, 304, 8, 24, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 1, 25, 5, 25, 324, 8, 25, 10, 25, 12, 25, 327, 9, 25, 1, 25, 3, 25, 330, 8, 25, 1, 25, 3, 25, 333, 8, 25, 1, 26, 1, 26, 1, 26, 1, 26, 5, 26, 339, 8, 26, 10, 26, 12, 26, 342, 9, 26, 1, 27, 1, 27, 1, 27, 5, 27, 347, 8, 27, 10, 27, 12, 27, 350, 9, 27, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 1, 28, 3, 28, 361, 8, 28, 1, 28, 1, 28, 3, 28, 365, 8, 28, 1, 28, 1, 28, 3, 28, 369, 8, 28, 1, 28, 1, 28, 3, 28, 373, 8, 28, 1, 29, 1, 29, 3, 29, 377, 8, 29, 1, 29, 1, 29, 1, 29, 1, 29, 1, 29, 3, 29, 384, 8, 29, 1, 30, 1, 30, 5, 30, 388, 8, 30, 10, 30, 12, 30, 391, 9, 30, 1, 30, 5, 30, 394, 8, 30, 10, 30, 12, 30, 397, 9, 30, 1, 30, 1, 30, 3, 30, 401, 8, 30, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 5, 31, 409, 8, 31, 10, 31, 12, 31, 412, 9, 31, 1, 32, 1, 32, 1, 32, 1, 32, 1, 32, 3, 32, 419, 8, 32, 1, 33, 1, 33, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 1, 34, 3, 34, 430, 8, 34, 1, 35, 1, 35, 1, 35, 5, 35, 435, 8, 35, 10, 35, 12, 35, 438, 9, 35, 1, 36, 1, 36, 1, 36, 5, 36, 443, 8, 36, 10, 36, 12, 36, 446, 9, 36, 1, 37, 1, 37, 1, 37, 5, 37, 451, 8, 37, 10, 37, 12, 37, 454, 9, 37, 1, 38, 1, 38, 1, 38, 5, 38, 459, 8, 38, 10, 38, 12, 38, 462, 9, 38, 1, 39, 1, 39, 1, 39, 5, 39, 467, 8, 39, 10, 39, 12, 39, 470, 9, 39, 1, 40, 1, 40, 1, 40, 5, 40, 475, 8, 40, 10, 40, 12, 40, 478, 9, 40, 1, 41, 1, 41, 1, 41, 5, 41, 483, 8, 41, 10, 41, 12, 41, 486, 9, 41, 1, 42, 1, 42, 1, 42, 1, 42, 3, 42, 492, 8, 42, 1, 43, 1, 43, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 3, 44, 507, 8, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 1, 44, 5, 44, 520, 8, 44, 10, 44, 12, 44, 523, 9, 44, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 1, 45, 3, 45, 537, 8, 45, 1, 46, 1, 46, 1, 47, 1, 47, 1, 47, 5, 47, 544, 8, 47, 10, 47, 12, 47, 547, 9, 47, 1, 48, 1, 48, 1, 48, 0, 2, 62, 88, 49, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 0, 8, 1, 0, 54, 64, 1, 0, 65, 66, 1, 0, 30, 33, 1, 0, 43, 44, 2, 0, 34, 34, 36, 36, 1, 0, 38, 40, 4, 0, 34, 38, 41, 41, 46, 46, 49, 49, 3, 0, 11, 11, 20, 20, 70, 72, 579, 0, 101, 1, 0, 0, 0, 2, 108, 1, 0, 0, 0, 4, 110, 1, 0, 0, 0, 6, 121, 1, 0, 0, 0, 8, 123, 1, 0, 0, 0, 10, 125, 1, 0, 0, 0, 12, 142, 1, 0, 0, 0, 14, 166, 1, 0, 0, 0, 16, 175, 1, 0, 0, 0, 18, 183, 1, 0, 0, 0, 20, 189, 1, 0, 0, 0, 22, 191, 1, 0, 0, 0, 24, 214, 1, 0, 0, 0, 26, 216, 1, 0, 0, 0, 28, 223, 1, 0, 0, 0, 30, 235, 1, 0, 0, 0, 32, 237, 1, 0, 0, 0, 34, 262, 1, 0, 0, 0, 36, 264, 1, 0, 0, 0, 38, 266, 1, 0, 0, 0, 40, 272, 1, 0, 0, 0, 42, 286, 1, 0, 0, 0, 44, 288, 1, 0, 0, 0, 46, 297, 1, 0, 0, 0, 48, 303, 1, 0, 0, 0, 50, 332, 1, 0, 0, 0, 52, 334, 1, 0, 0, 0, 54, 343, 1, 0, 0, 0, 56, 372, 1, 0, 0, 0, 58, 383, 1, 0, 0, 0, 60, 400, 1, 0, 0, 0, 62, 402, 1, 0, 0, 0, 64, 418, 1, 0, 0, 0, 66, 420, 1, 0, 0, 0, 68, 429, 1, 0, 0, 0, 70, 431, 1, 0, 0, 0, 72, 439, 1, 0, 0, 0, 74, 447, 1, 0, 0, 0, 76, 455, 1, 0, 0, 0, 78, 463, 1, 0, 0, 0, 80, 471, 1, 0, 0, 0, 82, 479, 1, 0, 0, 0, 84, 491, 1, 0, 0, 0, 86, 493, 1, 0, 0, 0, 88, 495, 1, 0, 0, 0, 90, 536, 1, 0, 0, 0, 92, 538, 1, 0, 0, 0, 94, 540, 1, 0, 0, 0, 96, 548, 1, 0, 0, 0, 98, 100, 3, 2, 1, 0, 99, 98, 1, 0, 0, 0, 100, 103, 1, 0, 0, 0, 101, 99, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 1, 1, 0, 0, 0, 103, 101, 1, 0, 0, 0, 104, 109, 3, 4, 2, 0, 105, 109, 3, 32, 16, 0, 106, 109, 3, 22, 11, 0, 107, 109, 3, 26, 13, 0, 108, 104, 1, 0, 0, 0, 108, 105, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 107, 1, 0, 0, 0, 109, 3, 1, 0, 0, 0, 110, 111, 3, 6, 3, 0, 111, 112, 3, 8, 4, 0, 112, 114, 5, 24, 0, 0, 113, 115, 3, 10, 5, 0, 114, 113, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 116, 1, 0, 0, 0, 116, 117, 5, 25, 0, 0, 117, 118, 3, 60, 30, 0, 118, 5, 1, 0, 0, 0, 119, 122, 3, 14, 7, 0, 120, 122, 5, 22, 0, 0, 121, 119, 1, 0, 0, 0, 121, 120, 1, 0, 0, 0, 122, 7, 1, 0, 0, 0, 123, 124, 5, 69, 0, 0, 124, 9, 1, 0, 0, 0, 125, 130, 3, 12, 6, 0, 126, 127, 5, 53, 0, 0, 127, 129, 3, 12, 6, 0, 128, 126, 1, 0, 0, 0, 129, 132, 1, 0, 0, 0, 130, 128, 1, 0, 0, 0, 130, 131, 1, 0, 0, 0, 131, 11, 1, 0, 0, 0, 132, 130, 1, 0, 0, 0, 133, 134, 3, 14, 7, 0, 134, 135, 5, 69, 0, 0, 135, 143, 1, 0, 0, 0, 136, 137, 3, 14, 7, 0, 137, 138, 5, 69, 0, 0, 138, 139, 5, 26, 0, 0, 139, 140, 5, 70, 0, 0, 140, 141, 5, 27, 0, 0, 141, 143, 1, 0, 0, 0, 142, 133, 1, 0, 0, 0, 142, 136, 1, 0, 0, 0, 143, 13, 1, 0, 0, 0, 144, 152, 3, 16, 8, 0, 145, 147, 5, 26, 0, 0, 146, 148, 5, 70, 0, 0, 147, 146, 1, 0, 0, 0, 147, 148, 1, 0, 0, 0, 148, 149, 1, 0, 0, 0, 149, 151, 5, 27, 0, 0, 150, 145, 1, 0, 0, 0, 151, 154, 1, 0, 0, 0, 152, 150, 1, 0, 0, 0, 152, 153, 1, 0, 0, 0, 153, 167, 1, 0, 0, 0, 154, 152, 1, 0, 0, 0, 155, 163, 3, 20, 10, 0, 156, 158, 5, 26, 0, 0, 157, 159, 5, 70, 0, 0, 158, 157, 1, 0, 0, 0, 158, 159, 1, 0, 0, 0, 159, 160, 1, 0, 0, 0, 160, 162, 5, 27, 0, 0, 161, 156, 1, 0, 0, 0, 162, 165, 1, 0, 0, 0, 163, 161, 1, 0, 0, 0, 163, 164, 1, 0, 0, 0, 164, 167, 1, 0, 0, 0, 165, 163, 1, 0, 0, 0, 166, 144, 1, 0, 0, 0, 166, 155, 1, 0, 0, 0, 167, 15, 1, 0, 0, 0, 168, 176, 5, 15, 0, 0, 169, 176, 5, 8, 0, 0, 170, 176, 5, 12, 0, 0, 171, 176, 5, 5, 0, 0, 172, 176, 5, 17, 0, 0, 173, 176, 5, 21, 0, 0, 174, 176, 3, 18, 9, 0, 175, 168, 1, 0, 0, 0, 175, 169, 1, 0, 0, 0, 175, 170, 1, 0, 0, 0, 175, 171, 1, 0, 0, 0, 175, 172, 1, 0, 0, 0, 175, 173, 1, 0, 0, 0, 175, 174, 1, 0, 0, 0, 176, 17, 1, 0, 0, 0, 177, 184, 5, 38, 0, 0, 178, 179, 5, 38, 0, 0, 179, 184, 5, 38, 0, 0, 180, 181, 5, 38, 0, 0, 181, 182, 5, 38, 0, 0, 182, 184, 5, 38, 0, 0, 183, 177, 1, 0, 0, 0, 183, 178, 1, 0, 0, 0, 183, 180, 1, 0, 0, 0, 184, 19, 1, 0, 0, 0, 185, 186, 5, 18, 0, 0, 186, 190, 5, 69, 0, 0, 187, 188, 5, 10, 0, 0, 188, 190, 5, 69, 0, 0, 189, 185, 1, 0, 0, 0, 189, 187, 1, 0, 0, 0, 190, 21, 1, 0, 0, 0, 191, 192, 5, 18, 0, 0, 192, 193, 5, 69, 0, 0, 193, 197, 5, 28, 0, 0, 194, 196, 3, 24, 12, 0, 195, 194, 1, 0, 0, 0, 196, 199, 1, 0, 0, 0, 197, 195, 1, 0, 0, 0, 197, 198, 1, 0, 0, 0, 198, 200, 1, 0, 0, 0, 199, 197, 1, 0, 0, 0, 200, 201, 5, 29, 0, 0, 201, 202, 5, 52, 0, 0, 202, 23, 1, 0, 0, 0, 203, 204, 3, 14, 7, 0, 204, 205, 5, 69, 0, 0, 205, 206, 5, 52, 0, 0, 206, 215, 1, 0, 0, 0, 207, 208, 3, 14, 7, 0, 208, 209, 5, 69, 0, 0, 209, 210, 5, 26, 0, 0, 210, 211, 5, 70, 0, 0, 211, 212, 5, 27, 0, 0, 212, 213, 5, 52, 0, 0, 213, 215, 1, 0, 0, 0, 214, 203, 1, 0, 0, 0, 214, 207, 1, 0, 0, 0, 215, 25, 1, 0, 0, 0, 216, 217, 5, 10, 0, 0, 217, 218, 5, 69, 0, 0, 218, 219, 5, 28, 0, 0, 219, 220, 3, 28, 14, 0, 220, 221, 5, 29, 0, 0, 221, 222, 5, 52, 0, 0, 222, 27, 1, 0, 0, 0, 223, 228, 3, 30, 15, 0, 224, 225, 5, 53, 0, 0, 225, 227, 3, 30, 15, 0, 226, 224, 1, 0, 0, 0, 227, 230, 1, 0, 0, 0, 228, 226, 1, 0, 0, 0, 228, 229, 1, 0, 0, 0, 229, 29, 1, 0, 0, 0, 230, 228, 1, 0, 0, 0, 231, 236, 5, 69, 0, 0, 232, 233, 5, 69, 0, 0, 233, 234, 5, 54, 0, 0, 234, 236, 5, 70, 0, 0, 235, 231, 1, 0, 0, 0, 235, 232, 1, 0, 0, 0, 236, 31, 1, 0, 0, 0, 237, 238, 3, 14, 7, 0, 238, 243, 3, 34, 17, 0, 239, 240, 5, 53, 0, 0, 240, 242, 3, 34, 17, 0, 241, 239, 1, 0, 0, 0, 242, 245, 1, 0, 0, 0, 243, 241, 1, 0, 0, 0, 243, 244, 1, 0, 0, 0, 244, 246, 1, 0, 0, 0, 245, 243, 1, 0, 0, 0, 246, 247, 5, 52, 0, 0, 247, 33, 1, 0, 0, 0, 248, 263, 5, 69, 0, 0, 249, 250, 5, 69, 0, 0, 250, 251, 5, 54, 0, 0, 251, 263, 3, 36, 18, 0, 252, 253, 5, 69, 0, 0, 253, 254, 5, 26, 0, 0, 254, 255, 5, 70, 0, 0, 255, 263, 5, 27, 0, 0, 256, 257, 5, 69, 0, 0, 257, 258, 5, 26, 0, 0, 258, 259, 5, 70, 0, 0, 259, 260, 5, 27, 0, 0, 260, 261, 5, 54, 0, 0, 261, 263, 3, 38, 19, 0, 262, 248, 1, 0, 0, 0, 262, 249, 1, 0, 0, 0, 262, 252, 1, 0, 0, 0, 262, 256, 1, 0, 0, 0, 263, 35, 1, 0, 0, 0, 264, 265, 3, 64, 32, 0, 265, 37, 1, 0, 0, 0, 266, 268, 5, 28, 0, 0, 267, 269, 3, 40, 20, 0, 268, 267, 1, 0, 0, 0, 268, 269, 1, 0, 0, 0, 269, 270, 1, 0, 0, 0, 270, 271, 5, 29, 0, 0, 271, 39, 1, 0, 0, 0, 272, 277, 3, 64, 32, 0, 273, 274, 5, 53, 0, 0, 274, 276, 3, 64, 32, 0, 275, 273, 1, 0, 0, 0, 276, 279, 1, 0, 0, 0, 277, 275, 1, 0, 0, 0, 277, 278, 1, 0, 0, 0, 278, 41, 1, 0, 0, 0, 279, 277, 1, 0, 0, 0, 280, 287, 3, 44, 22, 0, 281, 287, 3, 46, 23, 0, 282, 287, 3, 48, 24, 0, 283, 287, 3, 50, 25, 0, 284, 287, 3, 56, 28, 0, 285, 287, 3, 58, 29, 0, 286, 280, 1, 0, 0, 0, 286, 281, 1, 0, 0, 0, 286, 282, 1, 0, 0, 0, 286, 283, 1, 0, 0, 0, 286, 284, 1, 0, 0, 0, 286, 285, 1, 0, 0, 0, 287, 43, 1, 0, 0, 0, 288, 292, 5, 28, 0, 0, 289, 291, 3, 42, 21, 0, 290, 289, 1, 0, 0, 0, 291, 294, 1, 0, 0, 0, 292, 290, 1, 0, 0, 0, 292, 293, 1, 0, 0, 0, 293, 295, 1, 0, 0, 0, 294, 292, 1, 0, 0, 0, 295, 296, 5, 29, 0, 0, 296, 45, 1, 0, 0, 0, 297, 298, 3, 32, 16, 0, 298, 47, 1, 0, 0, 0, 299, 300, 3, 62, 31, 0, 300, 301, 5, 52, 0, 0, 301, 304, 1, 0, 0, 0, 302, 304, 5, 52, 0, 0, 303, 299, 1, 0, 0, 0, 303, 302, 1, 0, 0, 0, 304, 49, 1, 0, 0, 0, 305, 306, 5, 14, 0, 0, 306, 307, 5, 24, 0, 0, 307, 308, 3, 62, 31, 0, 308, 309, 5, 25, 0, 0, 309, 310, 3, 42, 21, 0, 310, 333, 1, 0, 0, 0, 311, 312, 5, 14, 0, 0, 312, 313, 5, 24, 0, 0, 313, 314, 3, 62, 31, 0, 314, 315, 5, 25, 0, 0, 315, 316, 3, 42, 21, 0, 316, 317, 5, 9, 0, 0, 317, 318, 3, 42, 21, 0, 318, 333, 1, 0, 0, 0, 319, 320, 5, 4, 0, 0, 320, 321, 5, 1, 0, 0, 321, 325, 5, 28, 0, 0, 322, 324, 3, 52, 26, 0, 323, 322, 1, 0, 0, 0, 324, 327, 1, 0, 0, 0, 325, 323, 1, 0, 0, 0, 325, 326, 1, 0, 0, 0, 326, 329, 1, 0, 0, 0, 327, 325, 1, 0, 0, 0, 328, 330, 3, 54, 27, 0, 329, 328, 1, 0, 0, 0, 329, 330, 1, 0, 0, 0, 330, 331, 1, 0, 0, 0, 331, 333, 5, 29, 0, 0, 332, 305, 1, 0, 0, 0, 332, 311, 1, 0, 0, 0, 332, 319, 1, 0, 0, 0, 333, 51, 1, 0, 0, 0, 334, 335, 5, 4, 0, 0, 335, 336, 3, 92, 46, 0, 336, 340, 5, 51, 0, 0, 337, 339, 3, 42, 21, 0, 338, 337, 1, 0, 0, 0, 339, 342, 1, 0, 0, 0, 340, 338, 1, 0, 0, 0, 340, 341, 1, 0, 0, 0, 341, 53, 1, 0, 0, 0, 342, 340, 1, 0, 0, 0, 343, 344, 5, 6, 0, 0, 344, 348, 5, 51, 0, 0, 345, 347, 3, 42, 21, 0, 346, 345, 1, 0, 0, 0, 347, 350, 1, 0, 0, 0, 348, 346, 1, 0, 0, 0, 348, 349, 1, 0, 0, 0, 349, 55, 1, 0, 0, 0, 350, 348, 1, 0, 0, 0, 351, 352, 5, 23, 0, 0, 352, 353, 5, 24, 0, 0, 353, 354, 3, 62, 31, 0, 354, 355, 5, 25, 0, 0, 355, 356, 3, 42, 21, 0, 356, 373, 1, 0, 0, 0, 357, 358, 5, 13, 0, 0, 358, 360, 5, 24, 0, 0, 359, 361, 3, 48, 24, 0, 360, 359, 1, 0, 0, 0, 360, 361, 1, 0, 0, 0, 361, 362, 1, 0, 0, 0, 362, 364, 5, 52, 0, 0, 363, 365, 3, 62, 31, 0, 364, 363, 1, 0, 0, 0, 364, 365, 1, 0, 0, 0, 365, 366, 1, 0, 0, 0, 366, 368, 5, 52, 0, 0, 367, 369, 3, 62, 31, 0, 368, 367, 1, 0, 0, 0, 368, 369, 1, 0, 0, 0, 369, 370, 1, 0, 0, 0, 370, 371, 5, 25, 0, 0, 371, 373, 3, 42, 21, 0, 372, 351, 1, 0, 0, 0, 372, 357, 1, 0, 0, 0, 373, 57, 1, 0, 0, 0, 374, 376, 5, 16, 0, 0, 375, 377, 3, 62, 31, 0, 376, 375, 1, 0, 0, 0, 376, 377, 1, 0, 0, 0, 377, 378, 1, 0, 0, 0, 378, 384, 5, 52, 0, 0, 379, 380, 5, 3, 0, 0, 380, 384, 5, 52, 0, 0, 381, 382, 5, 19, 0, 0, 382, 384, 5, 52, 0, 0, 383, 374, 1, 0, 0, 0, 383, 379, 1, 0, 0, 0, 383, 381, 1, 0, 0, 0, 384, 59, 1, 0, 0, 0, 385, 389, 5, 28, 0, 0, 386, 388, 3, 32, 16, 0, 387, 386, 1, 0, 0, 0, 388, 391, 1, 0, 0, 0, 389, 387, 1, 0, 0, 0, 389, 390, 1, 0, 0, 0, 390, 395, 1, 0, 0, 0, 391, 389, 1, 0, 0, 0, 392, 394, 3, 42, 21, 0, 393, 392, 1, 0, 0, 0, 394, 397, 1, 0, 0, 0, 395, 393, 1, 0, 0, 0, 395, 396, 1, 0, 0, 0, 396, 398, 1, 0, 0, 0, 397, 395, 1, 0, 0, 0, 398, 401, 5, 29, 0, 0, 399, 401, 3, 42, 21, 0, 400, 385, 1, 0, 0, 0, 400, 399, 1, 0, 0, 0, 401, 61, 1, 0, 0, 0, 402, 403, 6, 31, -1, 0, 403, 404, 3, 64, 32, 0, 404, 410, 1, 0, 0, 0, 405, 406, 10, 1, 0, 0, 406, 407, 5, 53, 0, 0, 407, 409, 3, 64, 32, 0, 408, 405, 1, 0, 0, 0, 409, 412, 1, 0, 0, 0, 410, 408, 1, 0, 0, 0, 410, 411, 1, 0, 0, 0, 411, 63, 1, 0, 0, 0, 412, 410, 1, 0, 0, 0, 413, 419, 3, 68, 34, 0, 414, 415, 3, 84, 42, 0, 415, 416, 3, 66, 33, 0, 416, 417, 3, 64, 32, 0, 417, 419, 1, 0, 0, 0, 418, 413, 1, 0, 0, 0, 418, 414, 1, 0, 0, 0, 419, 65, 1, 0, 0, 0, 420, 421, 7, 0, 0, 0, 421, 67, 1, 0, 0, 0, 422, 430, 3, 70, 35, 0, 423, 424, 3, 70, 35, 0, 424, 425, 5, 50, 0, 0, 425, 426, 3, 62, 31, 0, 426, 427, 5, 51, 0, 0, 427, 428, 3, 68, 34, 0, 428, 430, 1, 0, 0, 0, 429, 422, 1, 0, 0, 0, 429, 423, 1, 0, 0, 0, 430, 69, 1, 0, 0, 0, 431, 436, 3, 72, 36, 0, 432, 433, 5, 48, 0, 0, 433, 435, 3, 72, 36, 0, 434, 432, 1, 0, 0, 0, 435, 438, 1, 0, 0, 0, 436, 434, 1, 0, 0, 0, 436, 437, 1, 0, 0, 0, 437, 71, 1, 0, 0, 0, 438, 436, 1, 0, 0, 0, 439, 444, 3, 74, 37, 0, 440, 441, 5, 47, 0, 0, 441, 443, 3, 74, 37, 0, 442, 440, 1, 0, 0, 0, 443, 446, 1, 0, 0, 0, 444, 442, 1, 0, 0, 0, 444, 445, 1, 0, 0, 0, 445, 73, 1, 0, 0, 0, 446, 444, 1, 0, 0, 0, 447, 452, 3, 76, 38, 0, 448, 449, 7, 1, 0, 0, 449, 451, 3, 76, 38, 0, 450, 448, 1, 0, 0, 0, 451, 454, 1, 0, 0, 0, 452, 450, 1, 0, 0, 0, 452, 453, 1, 0, 0, 0, 453, 75, 1, 0, 0, 0, 454, 452, 1, 0, 0, 0, 455, 460, 3, 78, 39, 0, 456, 457, 7, 2, 0, 0, 457, 459, 3, 78, 39, 0, 458, 456, 1, 0, 0, 0, 459, 462, 1, 0, 0, 0, 460, 458, 1, 0, 0, 0, 460, 461, 1, 0, 0, 0, 461, 77, 1, 0, 0, 0, 462, 460, 1, 0, 0, 0, 463, 468, 3, 80, 40, 0, 464, 465, 7, 3, 0, 0, 465, 467, 3, 80, 40, 0, 466, 464, 1, 0, 0, 0, 467, 470, 1, 0, 0, 0, 468, 466, 1, 0, 0, 0, 468, 469, 1, 0, 0, 0, 469, 79, 1, 0, 0, 0, 470, 468, 1, 0, 0, 0, 471, 476, 3, 82, 41, 0, 472, 473, 7, 4, 0, 0, 473, 475, 3, 82, 41, 0, 474, 472, 1, 0, 0, 0, 475, 478, 1, 0, 0, 0, 476, 474, 1, 0, 0, 0, 476, 477, 1, 0, 0, 0, 477, 81, 1, 0, 0, 0, 478, 476, 1, 0, 0, 0, 479, 484, 3, 84, 42, 0, 480, 481, 7, 5, 0, 0, 481, 483, 3, 84, 42, 0, 482, 480, 1, 0, 0, 0, 483, 486, 1, 0, 0, 0, 484, 482, 1, 0, 0, 0, 484, 485, 1, 0, 0, 0, 485, 83, 1, 0, 0, 0, 486, 484, 1, 0, 0, 0, 487, 488, 3, 86, 43, 0, 488, 489, 3, 84, 42, 0, 489, 492, 1, 0, 0, 0, 490, 492, 3, 88, 44, 0, 491, 487, 1, 0, 0, 0, 491, 490, 1, 0, 0, 0, 492, 85, 1, 0, 0, 0, 493, 494, 7, 6, 0, 0, 494, 87, 1, 0, 0, 0, 495, 496, 6, 44, -1, 0, 496, 497, 3, 90, 45, 0, 497, 521, 1, 0, 0, 0, 498, 499, 10, 6, 0, 0, 499, 500, 5, 26, 0, 0, 500, 501, 3, 62, 31, 0, 501, 502, 5, 27, 0, 0, 502, 520, 1, 0, 0, 0, 503, 504, 10, 5, 0, 0, 504, 506, 5, 24, 0, 0, 505, 507, 3, 94, 47, 0, 506, 505, 1, 0, 0, 0, 506, 507, 1, 0, 0, 0, 507, 508, 1, 0, 0, 0, 508, 520, 5, 25, 0, 0, 509, 510, 10, 4, 0, 0, 510, 511, 5, 68, 0, 0, 511, 520, 5, 69, 0, 0, 512, 513, 10, 3, 0, 0, 513, 514, 5, 67, 0, 0, 514, 520, 5, 69, 0, 0, 515, 516, 10, 2, 0, 0, 516, 520, 5, 35, 0, 0, 517, 518, 10, 1, 0, 0, 518, 520, 5, 37, 0, 0, 519, 498, 1, 0, 0, 0, 519, 503, 1, 0, 0, 0, 519, 509, 1, 0, 0, 0, 519, 512, 1, 0, 0, 0, 519, 515, 1, 0, 0, 0, 519, 517, 1, 0, 0, 0, 520, 523, 1, 0, 0, 0, 521, 519, 1, 0, 0, 0, 521, 522, 1, 0, 0, 0, 522, 89, 1, 0, 0, 0, 523, 521, 1, 0, 0, 0, 524, 537, 5, 69, 0, 0, 525, 537, 3, 92, 46, 0, 526, 537, 5, 73, 0, 0, 527, 528, 5, 24, 0, 0, 528, 529, 3, 62, 31, 0, 529, 530, 5, 25, 0, 0, 530, 537, 1, 0, 0, 0, 531, 532, 5, 24, 0, 0, 532, 533, 3, 14, 7, 0, 533, 534, 5, 25, 0, 0, 534, 535, 3, 84, 42, 0, 535, 537, 1, 0, 0, 0, 536, 524, 1, 0, 0, 0, 536, 525, 1, 0, 0, 0, 536, 526, 1, 0, 0, 0, 536, 527, 1, 0, 0, 0, 536, 531, 1, 0, 0, 0, 537, 91, 1, 0, 0, 0, 538, 539, 7, 7, 0, 0, 539, 93, 1, 0, 0, 0, 540, 545, 3, 64, 32, 0, 541, 542, 5, 53, 0, 0, 542, 544, 3, 64, 32, 0, 543, 541, 1, 0, 0, 0, 544, 547, 1, 0, 0, 0, 545, 543, 1, 0, 0, 0, 545, 546, 1, 0, 0, 0, 546, 95, 1, 0, 0, 0, 547, 545, 1, 0, 0, 0, 548, 549, 5, 1, 0, 0, 549, 97, 1, 0, 0, 0, 55, 101, 108, 114, 121, 130, 142, 147, 152, 158, 163, 166, 175, 183, 189, 197, 214, 228, 235, 243, 262, 268, 277, 286, 292, 303, 325, 329, 332, 340, 348, 360, 364, 368, 372, 376, 383, 389, 395, 400, 410, 418, 429, 436, 444, 452, 460, 468, 476, 484, 491, 506, 519, 521, 536, 545] \ No newline at end of file diff --git a/zaplangParser.py b/zaplangParser.py new file mode 100644 index 0000000..e005902 --- /dev/null +++ b/zaplangParser.py @@ -0,0 +1,4523 @@ +# Generated from zaplangParser.g4 by ANTLR 4.13.2 +# encoding: utf-8 +from antlr4 import * +from io import StringIO +import sys +if sys.version_info[1] > 5: + from typing import TextIO +else: + from typing.io import TextIO + +def serializedATN(): + return [ + 4,1,78,551,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7, + 6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13, + 2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,20, + 7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,2,25,7,25,2,26,7,26, + 2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,31,7,31,2,32,7,32,2,33, + 7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,7,38,2,39,7,39, + 2,40,7,40,2,41,7,41,2,42,7,42,2,43,7,43,2,44,7,44,2,45,7,45,2,46, + 7,46,2,47,7,47,2,48,7,48,1,0,5,0,100,8,0,10,0,12,0,103,9,0,1,1,1, + 1,1,1,1,1,3,1,109,8,1,1,2,1,2,1,2,1,2,3,2,115,8,2,1,2,1,2,1,2,1, + 3,1,3,3,3,122,8,3,1,4,1,4,1,5,1,5,1,5,5,5,129,8,5,10,5,12,5,132, + 9,5,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,3,6,143,8,6,1,7,1,7,1,7, + 3,7,148,8,7,1,7,5,7,151,8,7,10,7,12,7,154,9,7,1,7,1,7,1,7,3,7,159, + 8,7,1,7,5,7,162,8,7,10,7,12,7,165,9,7,3,7,167,8,7,1,8,1,8,1,8,1, + 8,1,8,1,8,1,8,3,8,176,8,8,1,9,1,9,1,9,1,9,1,9,1,9,3,9,184,8,9,1, + 10,1,10,1,10,1,10,3,10,190,8,10,1,11,1,11,1,11,1,11,5,11,196,8,11, + 10,11,12,11,199,9,11,1,11,1,11,1,11,1,12,1,12,1,12,1,12,1,12,1,12, + 1,12,1,12,1,12,1,12,1,12,3,12,215,8,12,1,13,1,13,1,13,1,13,1,13, + 1,13,1,13,1,14,1,14,1,14,5,14,227,8,14,10,14,12,14,230,9,14,1,15, + 1,15,1,15,1,15,3,15,236,8,15,1,16,1,16,1,16,1,16,5,16,242,8,16,10, + 16,12,16,245,9,16,1,16,1,16,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1, + 17,1,17,1,17,1,17,1,17,1,17,1,17,3,17,263,8,17,1,18,1,18,1,19,1, + 19,3,19,269,8,19,1,19,1,19,1,20,1,20,1,20,5,20,276,8,20,10,20,12, + 20,279,9,20,1,21,1,21,1,21,1,21,1,21,1,21,3,21,287,8,21,1,22,1,22, + 5,22,291,8,22,10,22,12,22,294,9,22,1,22,1,22,1,23,1,23,1,24,1,24, + 1,24,1,24,3,24,304,8,24,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25, + 1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,1,25,5,25,324,8,25, + 10,25,12,25,327,9,25,1,25,3,25,330,8,25,1,25,3,25,333,8,25,1,26, + 1,26,1,26,1,26,5,26,339,8,26,10,26,12,26,342,9,26,1,27,1,27,1,27, + 5,27,347,8,27,10,27,12,27,350,9,27,1,28,1,28,1,28,1,28,1,28,1,28, + 1,28,1,28,1,28,3,28,361,8,28,1,28,1,28,3,28,365,8,28,1,28,1,28,3, + 28,369,8,28,1,28,1,28,3,28,373,8,28,1,29,1,29,3,29,377,8,29,1,29, + 1,29,1,29,1,29,1,29,3,29,384,8,29,1,30,1,30,5,30,388,8,30,10,30, + 12,30,391,9,30,1,30,5,30,394,8,30,10,30,12,30,397,9,30,1,30,1,30, + 3,30,401,8,30,1,31,1,31,1,31,1,31,1,31,1,31,5,31,409,8,31,10,31, + 12,31,412,9,31,1,32,1,32,1,32,1,32,1,32,3,32,419,8,32,1,33,1,33, + 1,34,1,34,1,34,1,34,1,34,1,34,1,34,3,34,430,8,34,1,35,1,35,1,35, + 5,35,435,8,35,10,35,12,35,438,9,35,1,36,1,36,1,36,5,36,443,8,36, + 10,36,12,36,446,9,36,1,37,1,37,1,37,5,37,451,8,37,10,37,12,37,454, + 9,37,1,38,1,38,1,38,5,38,459,8,38,10,38,12,38,462,9,38,1,39,1,39, + 1,39,5,39,467,8,39,10,39,12,39,470,9,39,1,40,1,40,1,40,5,40,475, + 8,40,10,40,12,40,478,9,40,1,41,1,41,1,41,5,41,483,8,41,10,41,12, + 41,486,9,41,1,42,1,42,1,42,1,42,3,42,492,8,42,1,43,1,43,1,44,1,44, + 1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,3,44,507,8,44,1,44, + 1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,1,44,5,44,520,8,44, + 10,44,12,44,523,9,44,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45,1,45, + 1,45,1,45,1,45,3,45,537,8,45,1,46,1,46,1,47,1,47,1,47,5,47,544,8, + 47,10,47,12,47,547,9,47,1,48,1,48,1,48,0,2,62,88,49,0,2,4,6,8,10, + 12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54, + 56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,0, + 8,1,0,54,64,1,0,65,66,1,0,30,33,1,0,43,44,2,0,34,34,36,36,1,0,38, + 40,4,0,34,38,41,41,46,46,49,49,3,0,11,11,20,20,70,72,579,0,101,1, + 0,0,0,2,108,1,0,0,0,4,110,1,0,0,0,6,121,1,0,0,0,8,123,1,0,0,0,10, + 125,1,0,0,0,12,142,1,0,0,0,14,166,1,0,0,0,16,175,1,0,0,0,18,183, + 1,0,0,0,20,189,1,0,0,0,22,191,1,0,0,0,24,214,1,0,0,0,26,216,1,0, + 0,0,28,223,1,0,0,0,30,235,1,0,0,0,32,237,1,0,0,0,34,262,1,0,0,0, + 36,264,1,0,0,0,38,266,1,0,0,0,40,272,1,0,0,0,42,286,1,0,0,0,44,288, + 1,0,0,0,46,297,1,0,0,0,48,303,1,0,0,0,50,332,1,0,0,0,52,334,1,0, + 0,0,54,343,1,0,0,0,56,372,1,0,0,0,58,383,1,0,0,0,60,400,1,0,0,0, + 62,402,1,0,0,0,64,418,1,0,0,0,66,420,1,0,0,0,68,429,1,0,0,0,70,431, + 1,0,0,0,72,439,1,0,0,0,74,447,1,0,0,0,76,455,1,0,0,0,78,463,1,0, + 0,0,80,471,1,0,0,0,82,479,1,0,0,0,84,491,1,0,0,0,86,493,1,0,0,0, + 88,495,1,0,0,0,90,536,1,0,0,0,92,538,1,0,0,0,94,540,1,0,0,0,96,548, + 1,0,0,0,98,100,3,2,1,0,99,98,1,0,0,0,100,103,1,0,0,0,101,99,1,0, + 0,0,101,102,1,0,0,0,102,1,1,0,0,0,103,101,1,0,0,0,104,109,3,4,2, + 0,105,109,3,32,16,0,106,109,3,22,11,0,107,109,3,26,13,0,108,104, + 1,0,0,0,108,105,1,0,0,0,108,106,1,0,0,0,108,107,1,0,0,0,109,3,1, + 0,0,0,110,111,3,6,3,0,111,112,3,8,4,0,112,114,5,24,0,0,113,115,3, + 10,5,0,114,113,1,0,0,0,114,115,1,0,0,0,115,116,1,0,0,0,116,117,5, + 25,0,0,117,118,3,60,30,0,118,5,1,0,0,0,119,122,3,14,7,0,120,122, + 5,22,0,0,121,119,1,0,0,0,121,120,1,0,0,0,122,7,1,0,0,0,123,124,5, + 69,0,0,124,9,1,0,0,0,125,130,3,12,6,0,126,127,5,53,0,0,127,129,3, + 12,6,0,128,126,1,0,0,0,129,132,1,0,0,0,130,128,1,0,0,0,130,131,1, + 0,0,0,131,11,1,0,0,0,132,130,1,0,0,0,133,134,3,14,7,0,134,135,5, + 69,0,0,135,143,1,0,0,0,136,137,3,14,7,0,137,138,5,69,0,0,138,139, + 5,26,0,0,139,140,5,70,0,0,140,141,5,27,0,0,141,143,1,0,0,0,142,133, + 1,0,0,0,142,136,1,0,0,0,143,13,1,0,0,0,144,152,3,16,8,0,145,147, + 5,26,0,0,146,148,5,70,0,0,147,146,1,0,0,0,147,148,1,0,0,0,148,149, + 1,0,0,0,149,151,5,27,0,0,150,145,1,0,0,0,151,154,1,0,0,0,152,150, + 1,0,0,0,152,153,1,0,0,0,153,167,1,0,0,0,154,152,1,0,0,0,155,163, + 3,20,10,0,156,158,5,26,0,0,157,159,5,70,0,0,158,157,1,0,0,0,158, + 159,1,0,0,0,159,160,1,0,0,0,160,162,5,27,0,0,161,156,1,0,0,0,162, + 165,1,0,0,0,163,161,1,0,0,0,163,164,1,0,0,0,164,167,1,0,0,0,165, + 163,1,0,0,0,166,144,1,0,0,0,166,155,1,0,0,0,167,15,1,0,0,0,168,176, + 5,15,0,0,169,176,5,8,0,0,170,176,5,12,0,0,171,176,5,5,0,0,172,176, + 5,17,0,0,173,176,5,21,0,0,174,176,3,18,9,0,175,168,1,0,0,0,175,169, + 1,0,0,0,175,170,1,0,0,0,175,171,1,0,0,0,175,172,1,0,0,0,175,173, + 1,0,0,0,175,174,1,0,0,0,176,17,1,0,0,0,177,184,5,38,0,0,178,179, + 5,38,0,0,179,184,5,38,0,0,180,181,5,38,0,0,181,182,5,38,0,0,182, + 184,5,38,0,0,183,177,1,0,0,0,183,178,1,0,0,0,183,180,1,0,0,0,184, + 19,1,0,0,0,185,186,5,18,0,0,186,190,5,69,0,0,187,188,5,10,0,0,188, + 190,5,69,0,0,189,185,1,0,0,0,189,187,1,0,0,0,190,21,1,0,0,0,191, + 192,5,18,0,0,192,193,5,69,0,0,193,197,5,28,0,0,194,196,3,24,12,0, + 195,194,1,0,0,0,196,199,1,0,0,0,197,195,1,0,0,0,197,198,1,0,0,0, + 198,200,1,0,0,0,199,197,1,0,0,0,200,201,5,29,0,0,201,202,5,52,0, + 0,202,23,1,0,0,0,203,204,3,14,7,0,204,205,5,69,0,0,205,206,5,52, + 0,0,206,215,1,0,0,0,207,208,3,14,7,0,208,209,5,69,0,0,209,210,5, + 26,0,0,210,211,5,70,0,0,211,212,5,27,0,0,212,213,5,52,0,0,213,215, + 1,0,0,0,214,203,1,0,0,0,214,207,1,0,0,0,215,25,1,0,0,0,216,217,5, + 10,0,0,217,218,5,69,0,0,218,219,5,28,0,0,219,220,3,28,14,0,220,221, + 5,29,0,0,221,222,5,52,0,0,222,27,1,0,0,0,223,228,3,30,15,0,224,225, + 5,53,0,0,225,227,3,30,15,0,226,224,1,0,0,0,227,230,1,0,0,0,228,226, + 1,0,0,0,228,229,1,0,0,0,229,29,1,0,0,0,230,228,1,0,0,0,231,236,5, + 69,0,0,232,233,5,69,0,0,233,234,5,54,0,0,234,236,5,70,0,0,235,231, + 1,0,0,0,235,232,1,0,0,0,236,31,1,0,0,0,237,238,3,14,7,0,238,243, + 3,34,17,0,239,240,5,53,0,0,240,242,3,34,17,0,241,239,1,0,0,0,242, + 245,1,0,0,0,243,241,1,0,0,0,243,244,1,0,0,0,244,246,1,0,0,0,245, + 243,1,0,0,0,246,247,5,52,0,0,247,33,1,0,0,0,248,263,5,69,0,0,249, + 250,5,69,0,0,250,251,5,54,0,0,251,263,3,36,18,0,252,253,5,69,0,0, + 253,254,5,26,0,0,254,255,5,70,0,0,255,263,5,27,0,0,256,257,5,69, + 0,0,257,258,5,26,0,0,258,259,5,70,0,0,259,260,5,27,0,0,260,261,5, + 54,0,0,261,263,3,38,19,0,262,248,1,0,0,0,262,249,1,0,0,0,262,252, + 1,0,0,0,262,256,1,0,0,0,263,35,1,0,0,0,264,265,3,64,32,0,265,37, + 1,0,0,0,266,268,5,28,0,0,267,269,3,40,20,0,268,267,1,0,0,0,268,269, + 1,0,0,0,269,270,1,0,0,0,270,271,5,29,0,0,271,39,1,0,0,0,272,277, + 3,64,32,0,273,274,5,53,0,0,274,276,3,64,32,0,275,273,1,0,0,0,276, + 279,1,0,0,0,277,275,1,0,0,0,277,278,1,0,0,0,278,41,1,0,0,0,279,277, + 1,0,0,0,280,287,3,44,22,0,281,287,3,46,23,0,282,287,3,48,24,0,283, + 287,3,50,25,0,284,287,3,56,28,0,285,287,3,58,29,0,286,280,1,0,0, + 0,286,281,1,0,0,0,286,282,1,0,0,0,286,283,1,0,0,0,286,284,1,0,0, + 0,286,285,1,0,0,0,287,43,1,0,0,0,288,292,5,28,0,0,289,291,3,42,21, + 0,290,289,1,0,0,0,291,294,1,0,0,0,292,290,1,0,0,0,292,293,1,0,0, + 0,293,295,1,0,0,0,294,292,1,0,0,0,295,296,5,29,0,0,296,45,1,0,0, + 0,297,298,3,32,16,0,298,47,1,0,0,0,299,300,3,62,31,0,300,301,5,52, + 0,0,301,304,1,0,0,0,302,304,5,52,0,0,303,299,1,0,0,0,303,302,1,0, + 0,0,304,49,1,0,0,0,305,306,5,14,0,0,306,307,5,24,0,0,307,308,3,62, + 31,0,308,309,5,25,0,0,309,310,3,42,21,0,310,333,1,0,0,0,311,312, + 5,14,0,0,312,313,5,24,0,0,313,314,3,62,31,0,314,315,5,25,0,0,315, + 316,3,42,21,0,316,317,5,9,0,0,317,318,3,42,21,0,318,333,1,0,0,0, + 319,320,5,4,0,0,320,321,5,1,0,0,321,325,5,28,0,0,322,324,3,52,26, + 0,323,322,1,0,0,0,324,327,1,0,0,0,325,323,1,0,0,0,325,326,1,0,0, + 0,326,329,1,0,0,0,327,325,1,0,0,0,328,330,3,54,27,0,329,328,1,0, + 0,0,329,330,1,0,0,0,330,331,1,0,0,0,331,333,5,29,0,0,332,305,1,0, + 0,0,332,311,1,0,0,0,332,319,1,0,0,0,333,51,1,0,0,0,334,335,5,4,0, + 0,335,336,3,92,46,0,336,340,5,51,0,0,337,339,3,42,21,0,338,337,1, + 0,0,0,339,342,1,0,0,0,340,338,1,0,0,0,340,341,1,0,0,0,341,53,1,0, + 0,0,342,340,1,0,0,0,343,344,5,6,0,0,344,348,5,51,0,0,345,347,3,42, + 21,0,346,345,1,0,0,0,347,350,1,0,0,0,348,346,1,0,0,0,348,349,1,0, + 0,0,349,55,1,0,0,0,350,348,1,0,0,0,351,352,5,23,0,0,352,353,5,24, + 0,0,353,354,3,62,31,0,354,355,5,25,0,0,355,356,3,42,21,0,356,373, + 1,0,0,0,357,358,5,13,0,0,358,360,5,24,0,0,359,361,3,48,24,0,360, + 359,1,0,0,0,360,361,1,0,0,0,361,362,1,0,0,0,362,364,5,52,0,0,363, + 365,3,62,31,0,364,363,1,0,0,0,364,365,1,0,0,0,365,366,1,0,0,0,366, + 368,5,52,0,0,367,369,3,62,31,0,368,367,1,0,0,0,368,369,1,0,0,0,369, + 370,1,0,0,0,370,371,5,25,0,0,371,373,3,42,21,0,372,351,1,0,0,0,372, + 357,1,0,0,0,373,57,1,0,0,0,374,376,5,16,0,0,375,377,3,62,31,0,376, + 375,1,0,0,0,376,377,1,0,0,0,377,378,1,0,0,0,378,384,5,52,0,0,379, + 380,5,3,0,0,380,384,5,52,0,0,381,382,5,19,0,0,382,384,5,52,0,0,383, + 374,1,0,0,0,383,379,1,0,0,0,383,381,1,0,0,0,384,59,1,0,0,0,385,389, + 5,28,0,0,386,388,3,32,16,0,387,386,1,0,0,0,388,391,1,0,0,0,389,387, + 1,0,0,0,389,390,1,0,0,0,390,395,1,0,0,0,391,389,1,0,0,0,392,394, + 3,42,21,0,393,392,1,0,0,0,394,397,1,0,0,0,395,393,1,0,0,0,395,396, + 1,0,0,0,396,398,1,0,0,0,397,395,1,0,0,0,398,401,5,29,0,0,399,401, + 3,42,21,0,400,385,1,0,0,0,400,399,1,0,0,0,401,61,1,0,0,0,402,403, + 6,31,-1,0,403,404,3,64,32,0,404,410,1,0,0,0,405,406,10,1,0,0,406, + 407,5,53,0,0,407,409,3,64,32,0,408,405,1,0,0,0,409,412,1,0,0,0,410, + 408,1,0,0,0,410,411,1,0,0,0,411,63,1,0,0,0,412,410,1,0,0,0,413,419, + 3,68,34,0,414,415,3,84,42,0,415,416,3,66,33,0,416,417,3,64,32,0, + 417,419,1,0,0,0,418,413,1,0,0,0,418,414,1,0,0,0,419,65,1,0,0,0,420, + 421,7,0,0,0,421,67,1,0,0,0,422,430,3,70,35,0,423,424,3,70,35,0,424, + 425,5,50,0,0,425,426,3,62,31,0,426,427,5,51,0,0,427,428,3,68,34, + 0,428,430,1,0,0,0,429,422,1,0,0,0,429,423,1,0,0,0,430,69,1,0,0,0, + 431,436,3,72,36,0,432,433,5,48,0,0,433,435,3,72,36,0,434,432,1,0, + 0,0,435,438,1,0,0,0,436,434,1,0,0,0,436,437,1,0,0,0,437,71,1,0,0, + 0,438,436,1,0,0,0,439,444,3,74,37,0,440,441,5,47,0,0,441,443,3,74, + 37,0,442,440,1,0,0,0,443,446,1,0,0,0,444,442,1,0,0,0,444,445,1,0, + 0,0,445,73,1,0,0,0,446,444,1,0,0,0,447,452,3,76,38,0,448,449,7,1, + 0,0,449,451,3,76,38,0,450,448,1,0,0,0,451,454,1,0,0,0,452,450,1, + 0,0,0,452,453,1,0,0,0,453,75,1,0,0,0,454,452,1,0,0,0,455,460,3,78, + 39,0,456,457,7,2,0,0,457,459,3,78,39,0,458,456,1,0,0,0,459,462,1, + 0,0,0,460,458,1,0,0,0,460,461,1,0,0,0,461,77,1,0,0,0,462,460,1,0, + 0,0,463,468,3,80,40,0,464,465,7,3,0,0,465,467,3,80,40,0,466,464, + 1,0,0,0,467,470,1,0,0,0,468,466,1,0,0,0,468,469,1,0,0,0,469,79,1, + 0,0,0,470,468,1,0,0,0,471,476,3,82,41,0,472,473,7,4,0,0,473,475, + 3,82,41,0,474,472,1,0,0,0,475,478,1,0,0,0,476,474,1,0,0,0,476,477, + 1,0,0,0,477,81,1,0,0,0,478,476,1,0,0,0,479,484,3,84,42,0,480,481, + 7,5,0,0,481,483,3,84,42,0,482,480,1,0,0,0,483,486,1,0,0,0,484,482, + 1,0,0,0,484,485,1,0,0,0,485,83,1,0,0,0,486,484,1,0,0,0,487,488,3, + 86,43,0,488,489,3,84,42,0,489,492,1,0,0,0,490,492,3,88,44,0,491, + 487,1,0,0,0,491,490,1,0,0,0,492,85,1,0,0,0,493,494,7,6,0,0,494,87, + 1,0,0,0,495,496,6,44,-1,0,496,497,3,90,45,0,497,521,1,0,0,0,498, + 499,10,6,0,0,499,500,5,26,0,0,500,501,3,62,31,0,501,502,5,27,0,0, + 502,520,1,0,0,0,503,504,10,5,0,0,504,506,5,24,0,0,505,507,3,94,47, + 0,506,505,1,0,0,0,506,507,1,0,0,0,507,508,1,0,0,0,508,520,5,25,0, + 0,509,510,10,4,0,0,510,511,5,68,0,0,511,520,5,69,0,0,512,513,10, + 3,0,0,513,514,5,67,0,0,514,520,5,69,0,0,515,516,10,2,0,0,516,520, + 5,35,0,0,517,518,10,1,0,0,518,520,5,37,0,0,519,498,1,0,0,0,519,503, + 1,0,0,0,519,509,1,0,0,0,519,512,1,0,0,0,519,515,1,0,0,0,519,517, + 1,0,0,0,520,523,1,0,0,0,521,519,1,0,0,0,521,522,1,0,0,0,522,89,1, + 0,0,0,523,521,1,0,0,0,524,537,5,69,0,0,525,537,3,92,46,0,526,537, + 5,73,0,0,527,528,5,24,0,0,528,529,3,62,31,0,529,530,5,25,0,0,530, + 537,1,0,0,0,531,532,5,24,0,0,532,533,3,14,7,0,533,534,5,25,0,0,534, + 535,3,84,42,0,535,537,1,0,0,0,536,524,1,0,0,0,536,525,1,0,0,0,536, + 526,1,0,0,0,536,527,1,0,0,0,536,531,1,0,0,0,537,91,1,0,0,0,538,539, + 7,7,0,0,539,93,1,0,0,0,540,545,3,64,32,0,541,542,5,53,0,0,542,544, + 3,64,32,0,543,541,1,0,0,0,544,547,1,0,0,0,545,543,1,0,0,0,545,546, + 1,0,0,0,546,95,1,0,0,0,547,545,1,0,0,0,548,549,5,1,0,0,549,97,1, + 0,0,0,55,101,108,114,121,130,142,147,152,158,163,166,175,183,189, + 197,214,228,235,243,262,268,277,286,292,303,325,329,332,340,348, + 360,364,368,372,376,383,389,395,400,410,418,429,436,444,452,460, + 468,476,484,491,506,519,521,536,545 + ] + +class zaplangParser ( Parser ): + + grammarFileName = "zaplangParser.g4" + + atn = ATNDeserializer().deserialize(serializedATN()) + + decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] + + sharedContextCache = PredictionContextCache() + + literalNames = [ "", "'bul'", "'func'", "'fin'", "'caso'", + "'carac'", "'pordef'", "'hacer'", "'doble'", "'sino'", + "'enum'", "'falso'", "'flot'", "'por'", "'si'", "'Ent'", + "'retornar'", "'cf'", "'estruct'", "'interrup'", "'verdadero'", + "'sf'", "'vacio'", "'mientras'", "'('", "')'", "'['", + "']'", "'{'", "'}'", "'<'", "'<='", "'>'", "'>='", + "'+'", "'++'", "'-'", "'--'", "'*'", "'/'", "'%'", + "'&'", "'|'", "'<<'", "'>>'", "'^'", "'~'", "'&&'", + "'||'", "'!'", "'?'", "':'", "';'", "','", "'='", "'*='", + "'/='", "'%='", "'+='", "'-='", "'&='", "'|='", "'<<='", + "'>>='", "'^='", "'=='", "'!='", "'->'", "'.'" ] + + symbolicNames = [ "", "Bul", "Func", "Fin", "Caso", "Carac", + "Pordef", "Hacer", "Doble", "Sino", "Enum", "Falso", + "Flot", "Por", "Si", "Ent", "Retornar", "ConFirma", + "Estruct", "Interrup", "Verdadero", "SinFirma", "Vacio", + "Mientras", "ParenIzq", "ParenDer", "CorcheteIzq", + "CorcheteDer", "LlaveIzq", "LlaveDer", "MenorQue", + "MenorOIgualQue", "MayorQue", "MayorOIgualQue", "Mas", + "MasMas", "Menos", "MenosMenos", "Estrella", "Div", + "Mod", "Y", "O", "DesplazIzq", "DesplazDer", "Xor", + "Complemento", "YY", "OO", "Not", "Pregunta", "DosPuntos", + "PuntoYComa", "Coma", "Asignar", "EstrellaAsignacion", + "DivAsignacion", "ModAsignacion", "MasAsignacion", + "MenosAsignacion", "YAsignacion", "OAsignacion", "DesplazIzqAsignacion", + "DesplazDerAsignacion", "XorAsignacion", "Igual", + "Diferente", "Flecha", "Punto", "Identificador", "ConstanteEntera", + "ConstanteFlotante", "ConstanteCaracteres", "CadenaLiteral", + "Whitespace", "Newline", "BlockComment", "LineComment", + "LineCommentHash" ] + + RULE_unidadTraduccion = 0 + RULE_declaracionExterna = 1 + RULE_declaracionFuncion = 2 + RULE_tipoRetorno = 3 + RULE_identificadorFuncion = 4 + RULE_listaParametros = 5 + RULE_declaracionParametro = 6 + RULE_especificadorTipo = 7 + RULE_tipoBasico = 8 + RULE_puntero = 9 + RULE_tipoEstructurado = 10 + RULE_declaracionEstruct = 11 + RULE_miembroEstruct = 12 + RULE_declaracionEnum = 13 + RULE_listaEnumeradores = 14 + RULE_enumerador = 15 + RULE_declaracionVariable = 16 + RULE_inicializadorVariable = 17 + RULE_inicializador = 18 + RULE_inicializadorArreglo = 19 + RULE_listaInitializers = 20 + RULE_sentencia = 21 + RULE_sentenciaCompuesta = 22 + RULE_sentenciaDeclaracion = 23 + RULE_sentenciaExpresion = 24 + RULE_sentenciaSeleccion = 25 + RULE_casoEtiqueta = 26 + RULE_etiquetaPorDef = 27 + RULE_sentenciaIteracion = 28 + RULE_sentenciaSalto = 29 + RULE_bloque = 30 + RULE_expresion = 31 + RULE_asignacionExpresion = 32 + RULE_operadorAsignacion = 33 + RULE_expresionCondicional = 34 + RULE_expresionLogicaO = 35 + RULE_expresionLogicaY = 36 + RULE_expresionIgualacion = 37 + RULE_expresionRelacional = 38 + RULE_expresionDesplazamiento = 39 + RULE_expresionAditiva = 40 + RULE_expresionMultiplicativa = 41 + RULE_expresionUnaria = 42 + RULE_operadorUnario = 43 + RULE_expresionPostfija = 44 + RULE_expresionPrimaria = 45 + RULE_constanteExpresion = 46 + RULE_listaArgumentos = 47 + RULE_marcaPunto = 48 + + ruleNames = [ "unidadTraduccion", "declaracionExterna", "declaracionFuncion", + "tipoRetorno", "identificadorFuncion", "listaParametros", + "declaracionParametro", "especificadorTipo", "tipoBasico", + "puntero", "tipoEstructurado", "declaracionEstruct", + "miembroEstruct", "declaracionEnum", "listaEnumeradores", + "enumerador", "declaracionVariable", "inicializadorVariable", + "inicializador", "inicializadorArreglo", "listaInitializers", + "sentencia", "sentenciaCompuesta", "sentenciaDeclaracion", + "sentenciaExpresion", "sentenciaSeleccion", "casoEtiqueta", + "etiquetaPorDef", "sentenciaIteracion", "sentenciaSalto", + "bloque", "expresion", "asignacionExpresion", "operadorAsignacion", + "expresionCondicional", "expresionLogicaO", "expresionLogicaY", + "expresionIgualacion", "expresionRelacional", "expresionDesplazamiento", + "expresionAditiva", "expresionMultiplicativa", "expresionUnaria", + "operadorUnario", "expresionPostfija", "expresionPrimaria", + "constanteExpresion", "listaArgumentos", "marcaPunto" ] + + EOF = Token.EOF + Bul=1 + Func=2 + Fin=3 + Caso=4 + Carac=5 + Pordef=6 + Hacer=7 + Doble=8 + Sino=9 + Enum=10 + Falso=11 + Flot=12 + Por=13 + Si=14 + Ent=15 + Retornar=16 + ConFirma=17 + Estruct=18 + Interrup=19 + Verdadero=20 + SinFirma=21 + Vacio=22 + Mientras=23 + ParenIzq=24 + ParenDer=25 + CorcheteIzq=26 + CorcheteDer=27 + LlaveIzq=28 + LlaveDer=29 + MenorQue=30 + MenorOIgualQue=31 + MayorQue=32 + MayorOIgualQue=33 + Mas=34 + MasMas=35 + Menos=36 + MenosMenos=37 + Estrella=38 + Div=39 + Mod=40 + Y=41 + O=42 + DesplazIzq=43 + DesplazDer=44 + Xor=45 + Complemento=46 + YY=47 + OO=48 + Not=49 + Pregunta=50 + DosPuntos=51 + PuntoYComa=52 + Coma=53 + Asignar=54 + EstrellaAsignacion=55 + DivAsignacion=56 + ModAsignacion=57 + MasAsignacion=58 + MenosAsignacion=59 + YAsignacion=60 + OAsignacion=61 + DesplazIzqAsignacion=62 + DesplazDerAsignacion=63 + XorAsignacion=64 + Igual=65 + Diferente=66 + Flecha=67 + Punto=68 + Identificador=69 + ConstanteEntera=70 + ConstanteFlotante=71 + ConstanteCaracteres=72 + CadenaLiteral=73 + Whitespace=74 + Newline=75 + BlockComment=76 + LineComment=77 + LineCommentHash=78 + + def __init__(self, input:TokenStream, output:TextIO = sys.stdout): + super().__init__(input, output) + self.checkVersion("4.13.2") + self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache) + self._predicates = None + + + + + class UnidadTraduccionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def declaracionExterna(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.DeclaracionExternaContext) + else: + return self.getTypedRuleContext(zaplangParser.DeclaracionExternaContext,i) + + + def getRuleIndex(self): + return zaplangParser.RULE_unidadTraduccion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterUnidadTraduccion" ): + listener.enterUnidadTraduccion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitUnidadTraduccion" ): + listener.exitUnidadTraduccion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitUnidadTraduccion" ): + return visitor.visitUnidadTraduccion(self) + else: + return visitor.visitChildren(self) + + + + + def unidadTraduccion(self): + + localctx = zaplangParser.UnidadTraduccionContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_unidadTraduccion) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 101 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 274884629792) != 0): + self.state = 98 + self.declaracionExterna() + self.state = 103 + self._errHandler.sync(self) + _la = self._input.LA(1) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DeclaracionExternaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def declaracionFuncion(self): + return self.getTypedRuleContext(zaplangParser.DeclaracionFuncionContext,0) + + + def declaracionVariable(self): + return self.getTypedRuleContext(zaplangParser.DeclaracionVariableContext,0) + + + def declaracionEstruct(self): + return self.getTypedRuleContext(zaplangParser.DeclaracionEstructContext,0) + + + def declaracionEnum(self): + return self.getTypedRuleContext(zaplangParser.DeclaracionEnumContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_declaracionExterna + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeclaracionExterna" ): + listener.enterDeclaracionExterna(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeclaracionExterna" ): + listener.exitDeclaracionExterna(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeclaracionExterna" ): + return visitor.visitDeclaracionExterna(self) + else: + return visitor.visitChildren(self) + + + + + def declaracionExterna(self): + + localctx = zaplangParser.DeclaracionExternaContext(self, self._ctx, self.state) + self.enterRule(localctx, 2, self.RULE_declaracionExterna) + try: + self.state = 108 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,1,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 104 + self.declaracionFuncion() + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 105 + self.declaracionVariable() + pass + + elif la_ == 3: + self.enterOuterAlt(localctx, 3) + self.state = 106 + self.declaracionEstruct() + pass + + elif la_ == 4: + self.enterOuterAlt(localctx, 4) + self.state = 107 + self.declaracionEnum() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DeclaracionFuncionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def tipoRetorno(self): + return self.getTypedRuleContext(zaplangParser.TipoRetornoContext,0) + + + def identificadorFuncion(self): + return self.getTypedRuleContext(zaplangParser.IdentificadorFuncionContext,0) + + + def ParenIzq(self): + return self.getToken(zaplangParser.ParenIzq, 0) + + def ParenDer(self): + return self.getToken(zaplangParser.ParenDer, 0) + + def bloque(self): + return self.getTypedRuleContext(zaplangParser.BloqueContext,0) + + + def listaParametros(self): + return self.getTypedRuleContext(zaplangParser.ListaParametrosContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_declaracionFuncion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeclaracionFuncion" ): + listener.enterDeclaracionFuncion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeclaracionFuncion" ): + listener.exitDeclaracionFuncion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeclaracionFuncion" ): + return visitor.visitDeclaracionFuncion(self) + else: + return visitor.visitChildren(self) + + + + + def declaracionFuncion(self): + + localctx = zaplangParser.DeclaracionFuncionContext(self, self._ctx, self.state) + self.enterRule(localctx, 4, self.RULE_declaracionFuncion) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 110 + self.tipoRetorno() + self.state = 111 + self.identificadorFuncion() + self.state = 112 + self.match(zaplangParser.ParenIzq) + self.state = 114 + self._errHandler.sync(self) + _la = self._input.LA(1) + if (((_la) & ~0x3f) == 0 and ((1 << _la) & 274880435488) != 0): + self.state = 113 + self.listaParametros() + + + self.state = 116 + self.match(zaplangParser.ParenDer) + self.state = 117 + self.bloque() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class TipoRetornoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def especificadorTipo(self): + return self.getTypedRuleContext(zaplangParser.EspecificadorTipoContext,0) + + + def Vacio(self): + return self.getToken(zaplangParser.Vacio, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_tipoRetorno + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTipoRetorno" ): + listener.enterTipoRetorno(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTipoRetorno" ): + listener.exitTipoRetorno(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitTipoRetorno" ): + return visitor.visitTipoRetorno(self) + else: + return visitor.visitChildren(self) + + + + + def tipoRetorno(self): + + localctx = zaplangParser.TipoRetornoContext(self, self._ctx, self.state) + self.enterRule(localctx, 6, self.RULE_tipoRetorno) + try: + self.state = 121 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [5, 8, 10, 12, 15, 17, 18, 21, 38]: + self.enterOuterAlt(localctx, 1) + self.state = 119 + self.especificadorTipo() + pass + elif token in [22]: + self.enterOuterAlt(localctx, 2) + self.state = 120 + self.match(zaplangParser.Vacio) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class IdentificadorFuncionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_identificadorFuncion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterIdentificadorFuncion" ): + listener.enterIdentificadorFuncion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitIdentificadorFuncion" ): + listener.exitIdentificadorFuncion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitIdentificadorFuncion" ): + return visitor.visitIdentificadorFuncion(self) + else: + return visitor.visitChildren(self) + + + + + def identificadorFuncion(self): + + localctx = zaplangParser.IdentificadorFuncionContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_identificadorFuncion) + try: + self.enterOuterAlt(localctx, 1) + self.state = 123 + self.match(zaplangParser.Identificador) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ListaParametrosContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def declaracionParametro(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.DeclaracionParametroContext) + else: + return self.getTypedRuleContext(zaplangParser.DeclaracionParametroContext,i) + + + def Coma(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Coma) + else: + return self.getToken(zaplangParser.Coma, i) + + def getRuleIndex(self): + return zaplangParser.RULE_listaParametros + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterListaParametros" ): + listener.enterListaParametros(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitListaParametros" ): + listener.exitListaParametros(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitListaParametros" ): + return visitor.visitListaParametros(self) + else: + return visitor.visitChildren(self) + + + + + def listaParametros(self): + + localctx = zaplangParser.ListaParametrosContext(self, self._ctx, self.state) + self.enterRule(localctx, 10, self.RULE_listaParametros) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 125 + self.declaracionParametro() + self.state = 130 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==53: + self.state = 126 + self.match(zaplangParser.Coma) + self.state = 127 + self.declaracionParametro() + self.state = 132 + self._errHandler.sync(self) + _la = self._input.LA(1) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DeclaracionParametroContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def especificadorTipo(self): + return self.getTypedRuleContext(zaplangParser.EspecificadorTipoContext,0) + + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def CorcheteIzq(self): + return self.getToken(zaplangParser.CorcheteIzq, 0) + + def ConstanteEntera(self): + return self.getToken(zaplangParser.ConstanteEntera, 0) + + def CorcheteDer(self): + return self.getToken(zaplangParser.CorcheteDer, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_declaracionParametro + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeclaracionParametro" ): + listener.enterDeclaracionParametro(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeclaracionParametro" ): + listener.exitDeclaracionParametro(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeclaracionParametro" ): + return visitor.visitDeclaracionParametro(self) + else: + return visitor.visitChildren(self) + + + + + def declaracionParametro(self): + + localctx = zaplangParser.DeclaracionParametroContext(self, self._ctx, self.state) + self.enterRule(localctx, 12, self.RULE_declaracionParametro) + try: + self.state = 142 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,5,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 133 + self.especificadorTipo() + self.state = 134 + self.match(zaplangParser.Identificador) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 136 + self.especificadorTipo() + self.state = 137 + self.match(zaplangParser.Identificador) + self.state = 138 + self.match(zaplangParser.CorcheteIzq) + self.state = 139 + self.match(zaplangParser.ConstanteEntera) + self.state = 140 + self.match(zaplangParser.CorcheteDer) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class EspecificadorTipoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def tipoBasico(self): + return self.getTypedRuleContext(zaplangParser.TipoBasicoContext,0) + + + def CorcheteIzq(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.CorcheteIzq) + else: + return self.getToken(zaplangParser.CorcheteIzq, i) + + def CorcheteDer(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.CorcheteDer) + else: + return self.getToken(zaplangParser.CorcheteDer, i) + + def ConstanteEntera(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.ConstanteEntera) + else: + return self.getToken(zaplangParser.ConstanteEntera, i) + + def tipoEstructurado(self): + return self.getTypedRuleContext(zaplangParser.TipoEstructuradoContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_especificadorTipo + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEspecificadorTipo" ): + listener.enterEspecificadorTipo(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEspecificadorTipo" ): + listener.exitEspecificadorTipo(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitEspecificadorTipo" ): + return visitor.visitEspecificadorTipo(self) + else: + return visitor.visitChildren(self) + + + + + def especificadorTipo(self): + + localctx = zaplangParser.EspecificadorTipoContext(self, self._ctx, self.state) + self.enterRule(localctx, 14, self.RULE_especificadorTipo) + self._la = 0 # Token type + try: + self.state = 166 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [5, 8, 12, 15, 17, 21, 38]: + self.enterOuterAlt(localctx, 1) + self.state = 144 + self.tipoBasico() + self.state = 152 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==26: + self.state = 145 + self.match(zaplangParser.CorcheteIzq) + self.state = 147 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==70: + self.state = 146 + self.match(zaplangParser.ConstanteEntera) + + + self.state = 149 + self.match(zaplangParser.CorcheteDer) + self.state = 154 + self._errHandler.sync(self) + _la = self._input.LA(1) + + pass + elif token in [10, 18]: + self.enterOuterAlt(localctx, 2) + self.state = 155 + self.tipoEstructurado() + self.state = 163 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==26: + self.state = 156 + self.match(zaplangParser.CorcheteIzq) + self.state = 158 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==70: + self.state = 157 + self.match(zaplangParser.ConstanteEntera) + + + self.state = 160 + self.match(zaplangParser.CorcheteDer) + self.state = 165 + self._errHandler.sync(self) + _la = self._input.LA(1) + + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class TipoBasicoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Ent(self): + return self.getToken(zaplangParser.Ent, 0) + + def Doble(self): + return self.getToken(zaplangParser.Doble, 0) + + def Flot(self): + return self.getToken(zaplangParser.Flot, 0) + + def Carac(self): + return self.getToken(zaplangParser.Carac, 0) + + def ConFirma(self): + return self.getToken(zaplangParser.ConFirma, 0) + + def SinFirma(self): + return self.getToken(zaplangParser.SinFirma, 0) + + def puntero(self): + return self.getTypedRuleContext(zaplangParser.PunteroContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_tipoBasico + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTipoBasico" ): + listener.enterTipoBasico(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTipoBasico" ): + listener.exitTipoBasico(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitTipoBasico" ): + return visitor.visitTipoBasico(self) + else: + return visitor.visitChildren(self) + + + + + def tipoBasico(self): + + localctx = zaplangParser.TipoBasicoContext(self, self._ctx, self.state) + self.enterRule(localctx, 16, self.RULE_tipoBasico) + try: + self.state = 175 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [15]: + self.enterOuterAlt(localctx, 1) + self.state = 168 + self.match(zaplangParser.Ent) + pass + elif token in [8]: + self.enterOuterAlt(localctx, 2) + self.state = 169 + self.match(zaplangParser.Doble) + pass + elif token in [12]: + self.enterOuterAlt(localctx, 3) + self.state = 170 + self.match(zaplangParser.Flot) + pass + elif token in [5]: + self.enterOuterAlt(localctx, 4) + self.state = 171 + self.match(zaplangParser.Carac) + pass + elif token in [17]: + self.enterOuterAlt(localctx, 5) + self.state = 172 + self.match(zaplangParser.ConFirma) + pass + elif token in [21]: + self.enterOuterAlt(localctx, 6) + self.state = 173 + self.match(zaplangParser.SinFirma) + pass + elif token in [38]: + self.enterOuterAlt(localctx, 7) + self.state = 174 + self.puntero() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class PunteroContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Estrella(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Estrella) + else: + return self.getToken(zaplangParser.Estrella, i) + + def getRuleIndex(self): + return zaplangParser.RULE_puntero + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterPuntero" ): + listener.enterPuntero(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitPuntero" ): + listener.exitPuntero(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitPuntero" ): + return visitor.visitPuntero(self) + else: + return visitor.visitChildren(self) + + + + + def puntero(self): + + localctx = zaplangParser.PunteroContext(self, self._ctx, self.state) + self.enterRule(localctx, 18, self.RULE_puntero) + try: + self.state = 183 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,12,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 177 + self.match(zaplangParser.Estrella) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 178 + self.match(zaplangParser.Estrella) + self.state = 179 + self.match(zaplangParser.Estrella) + pass + + elif la_ == 3: + self.enterOuterAlt(localctx, 3) + self.state = 180 + self.match(zaplangParser.Estrella) + self.state = 181 + self.match(zaplangParser.Estrella) + self.state = 182 + self.match(zaplangParser.Estrella) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class TipoEstructuradoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Estruct(self): + return self.getToken(zaplangParser.Estruct, 0) + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def Enum(self): + return self.getToken(zaplangParser.Enum, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_tipoEstructurado + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterTipoEstructurado" ): + listener.enterTipoEstructurado(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitTipoEstructurado" ): + listener.exitTipoEstructurado(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitTipoEstructurado" ): + return visitor.visitTipoEstructurado(self) + else: + return visitor.visitChildren(self) + + + + + def tipoEstructurado(self): + + localctx = zaplangParser.TipoEstructuradoContext(self, self._ctx, self.state) + self.enterRule(localctx, 20, self.RULE_tipoEstructurado) + try: + self.state = 189 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [18]: + self.enterOuterAlt(localctx, 1) + self.state = 185 + self.match(zaplangParser.Estruct) + self.state = 186 + self.match(zaplangParser.Identificador) + pass + elif token in [10]: + self.enterOuterAlt(localctx, 2) + self.state = 187 + self.match(zaplangParser.Enum) + self.state = 188 + self.match(zaplangParser.Identificador) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DeclaracionEstructContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Estruct(self): + return self.getToken(zaplangParser.Estruct, 0) + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def LlaveIzq(self): + return self.getToken(zaplangParser.LlaveIzq, 0) + + def LlaveDer(self): + return self.getToken(zaplangParser.LlaveDer, 0) + + def PuntoYComa(self): + return self.getToken(zaplangParser.PuntoYComa, 0) + + def miembroEstruct(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.MiembroEstructContext) + else: + return self.getTypedRuleContext(zaplangParser.MiembroEstructContext,i) + + + def getRuleIndex(self): + return zaplangParser.RULE_declaracionEstruct + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeclaracionEstruct" ): + listener.enterDeclaracionEstruct(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeclaracionEstruct" ): + listener.exitDeclaracionEstruct(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeclaracionEstruct" ): + return visitor.visitDeclaracionEstruct(self) + else: + return visitor.visitChildren(self) + + + + + def declaracionEstruct(self): + + localctx = zaplangParser.DeclaracionEstructContext(self, self._ctx, self.state) + self.enterRule(localctx, 22, self.RULE_declaracionEstruct) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 191 + self.match(zaplangParser.Estruct) + self.state = 192 + self.match(zaplangParser.Identificador) + self.state = 193 + self.match(zaplangParser.LlaveIzq) + self.state = 197 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 274880435488) != 0): + self.state = 194 + self.miembroEstruct() + self.state = 199 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 200 + self.match(zaplangParser.LlaveDer) + self.state = 201 + self.match(zaplangParser.PuntoYComa) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class MiembroEstructContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def especificadorTipo(self): + return self.getTypedRuleContext(zaplangParser.EspecificadorTipoContext,0) + + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def PuntoYComa(self): + return self.getToken(zaplangParser.PuntoYComa, 0) + + def CorcheteIzq(self): + return self.getToken(zaplangParser.CorcheteIzq, 0) + + def ConstanteEntera(self): + return self.getToken(zaplangParser.ConstanteEntera, 0) + + def CorcheteDer(self): + return self.getToken(zaplangParser.CorcheteDer, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_miembroEstruct + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterMiembroEstruct" ): + listener.enterMiembroEstruct(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitMiembroEstruct" ): + listener.exitMiembroEstruct(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitMiembroEstruct" ): + return visitor.visitMiembroEstruct(self) + else: + return visitor.visitChildren(self) + + + + + def miembroEstruct(self): + + localctx = zaplangParser.MiembroEstructContext(self, self._ctx, self.state) + self.enterRule(localctx, 24, self.RULE_miembroEstruct) + try: + self.state = 214 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,15,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 203 + self.especificadorTipo() + self.state = 204 + self.match(zaplangParser.Identificador) + self.state = 205 + self.match(zaplangParser.PuntoYComa) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 207 + self.especificadorTipo() + self.state = 208 + self.match(zaplangParser.Identificador) + self.state = 209 + self.match(zaplangParser.CorcheteIzq) + self.state = 210 + self.match(zaplangParser.ConstanteEntera) + self.state = 211 + self.match(zaplangParser.CorcheteDer) + self.state = 212 + self.match(zaplangParser.PuntoYComa) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DeclaracionEnumContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Enum(self): + return self.getToken(zaplangParser.Enum, 0) + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def LlaveIzq(self): + return self.getToken(zaplangParser.LlaveIzq, 0) + + def listaEnumeradores(self): + return self.getTypedRuleContext(zaplangParser.ListaEnumeradoresContext,0) + + + def LlaveDer(self): + return self.getToken(zaplangParser.LlaveDer, 0) + + def PuntoYComa(self): + return self.getToken(zaplangParser.PuntoYComa, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_declaracionEnum + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeclaracionEnum" ): + listener.enterDeclaracionEnum(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeclaracionEnum" ): + listener.exitDeclaracionEnum(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeclaracionEnum" ): + return visitor.visitDeclaracionEnum(self) + else: + return visitor.visitChildren(self) + + + + + def declaracionEnum(self): + + localctx = zaplangParser.DeclaracionEnumContext(self, self._ctx, self.state) + self.enterRule(localctx, 26, self.RULE_declaracionEnum) + try: + self.enterOuterAlt(localctx, 1) + self.state = 216 + self.match(zaplangParser.Enum) + self.state = 217 + self.match(zaplangParser.Identificador) + self.state = 218 + self.match(zaplangParser.LlaveIzq) + self.state = 219 + self.listaEnumeradores() + self.state = 220 + self.match(zaplangParser.LlaveDer) + self.state = 221 + self.match(zaplangParser.PuntoYComa) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ListaEnumeradoresContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def enumerador(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.EnumeradorContext) + else: + return self.getTypedRuleContext(zaplangParser.EnumeradorContext,i) + + + def Coma(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Coma) + else: + return self.getToken(zaplangParser.Coma, i) + + def getRuleIndex(self): + return zaplangParser.RULE_listaEnumeradores + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterListaEnumeradores" ): + listener.enterListaEnumeradores(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitListaEnumeradores" ): + listener.exitListaEnumeradores(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitListaEnumeradores" ): + return visitor.visitListaEnumeradores(self) + else: + return visitor.visitChildren(self) + + + + + def listaEnumeradores(self): + + localctx = zaplangParser.ListaEnumeradoresContext(self, self._ctx, self.state) + self.enterRule(localctx, 28, self.RULE_listaEnumeradores) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 223 + self.enumerador() + self.state = 228 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==53: + self.state = 224 + self.match(zaplangParser.Coma) + self.state = 225 + self.enumerador() + self.state = 230 + self._errHandler.sync(self) + _la = self._input.LA(1) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class EnumeradorContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def Asignar(self): + return self.getToken(zaplangParser.Asignar, 0) + + def ConstanteEntera(self): + return self.getToken(zaplangParser.ConstanteEntera, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_enumerador + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEnumerador" ): + listener.enterEnumerador(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEnumerador" ): + listener.exitEnumerador(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitEnumerador" ): + return visitor.visitEnumerador(self) + else: + return visitor.visitChildren(self) + + + + + def enumerador(self): + + localctx = zaplangParser.EnumeradorContext(self, self._ctx, self.state) + self.enterRule(localctx, 30, self.RULE_enumerador) + try: + self.state = 235 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,17,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 231 + self.match(zaplangParser.Identificador) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 232 + self.match(zaplangParser.Identificador) + self.state = 233 + self.match(zaplangParser.Asignar) + self.state = 234 + self.match(zaplangParser.ConstanteEntera) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class DeclaracionVariableContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def especificadorTipo(self): + return self.getTypedRuleContext(zaplangParser.EspecificadorTipoContext,0) + + + def inicializadorVariable(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.InicializadorVariableContext) + else: + return self.getTypedRuleContext(zaplangParser.InicializadorVariableContext,i) + + + def PuntoYComa(self): + return self.getToken(zaplangParser.PuntoYComa, 0) + + def Coma(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Coma) + else: + return self.getToken(zaplangParser.Coma, i) + + def getRuleIndex(self): + return zaplangParser.RULE_declaracionVariable + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterDeclaracionVariable" ): + listener.enterDeclaracionVariable(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitDeclaracionVariable" ): + listener.exitDeclaracionVariable(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitDeclaracionVariable" ): + return visitor.visitDeclaracionVariable(self) + else: + return visitor.visitChildren(self) + + + + + def declaracionVariable(self): + + localctx = zaplangParser.DeclaracionVariableContext(self, self._ctx, self.state) + self.enterRule(localctx, 32, self.RULE_declaracionVariable) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 237 + self.especificadorTipo() + self.state = 238 + self.inicializadorVariable() + self.state = 243 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==53: + self.state = 239 + self.match(zaplangParser.Coma) + self.state = 240 + self.inicializadorVariable() + self.state = 245 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 246 + self.match(zaplangParser.PuntoYComa) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class InicializadorVariableContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def Asignar(self): + return self.getToken(zaplangParser.Asignar, 0) + + def inicializador(self): + return self.getTypedRuleContext(zaplangParser.InicializadorContext,0) + + + def CorcheteIzq(self): + return self.getToken(zaplangParser.CorcheteIzq, 0) + + def ConstanteEntera(self): + return self.getToken(zaplangParser.ConstanteEntera, 0) + + def CorcheteDer(self): + return self.getToken(zaplangParser.CorcheteDer, 0) + + def inicializadorArreglo(self): + return self.getTypedRuleContext(zaplangParser.InicializadorArregloContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_inicializadorVariable + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInicializadorVariable" ): + listener.enterInicializadorVariable(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInicializadorVariable" ): + listener.exitInicializadorVariable(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInicializadorVariable" ): + return visitor.visitInicializadorVariable(self) + else: + return visitor.visitChildren(self) + + + + + def inicializadorVariable(self): + + localctx = zaplangParser.InicializadorVariableContext(self, self._ctx, self.state) + self.enterRule(localctx, 34, self.RULE_inicializadorVariable) + try: + self.state = 262 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,19,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 248 + self.match(zaplangParser.Identificador) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 249 + self.match(zaplangParser.Identificador) + self.state = 250 + self.match(zaplangParser.Asignar) + self.state = 251 + self.inicializador() + pass + + elif la_ == 3: + self.enterOuterAlt(localctx, 3) + self.state = 252 + self.match(zaplangParser.Identificador) + self.state = 253 + self.match(zaplangParser.CorcheteIzq) + self.state = 254 + self.match(zaplangParser.ConstanteEntera) + self.state = 255 + self.match(zaplangParser.CorcheteDer) + pass + + elif la_ == 4: + self.enterOuterAlt(localctx, 4) + self.state = 256 + self.match(zaplangParser.Identificador) + self.state = 257 + self.match(zaplangParser.CorcheteIzq) + self.state = 258 + self.match(zaplangParser.ConstanteEntera) + self.state = 259 + self.match(zaplangParser.CorcheteDer) + self.state = 260 + self.match(zaplangParser.Asignar) + self.state = 261 + self.inicializadorArreglo() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class InicializadorContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def asignacionExpresion(self): + return self.getTypedRuleContext(zaplangParser.AsignacionExpresionContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_inicializador + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInicializador" ): + listener.enterInicializador(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInicializador" ): + listener.exitInicializador(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInicializador" ): + return visitor.visitInicializador(self) + else: + return visitor.visitChildren(self) + + + + + def inicializador(self): + + localctx = zaplangParser.InicializadorContext(self, self._ctx, self.state) + self.enterRule(localctx, 36, self.RULE_inicializador) + try: + self.enterOuterAlt(localctx, 1) + self.state = 264 + self.asignacionExpresion() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class InicializadorArregloContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LlaveIzq(self): + return self.getToken(zaplangParser.LlaveIzq, 0) + + def LlaveDer(self): + return self.getToken(zaplangParser.LlaveDer, 0) + + def listaInitializers(self): + return self.getTypedRuleContext(zaplangParser.ListaInitializersContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_inicializadorArreglo + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterInicializadorArreglo" ): + listener.enterInicializadorArreglo(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitInicializadorArreglo" ): + listener.exitInicializadorArreglo(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitInicializadorArreglo" ): + return visitor.visitInicializadorArreglo(self) + else: + return visitor.visitChildren(self) + + + + + def inicializadorArreglo(self): + + localctx = zaplangParser.InicializadorArregloContext(self, self._ctx, self.state) + self.enterRule(localctx, 38, self.RULE_inicializadorArreglo) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 266 + self.match(zaplangParser.LlaveIzq) + self.state = 268 + self._errHandler.sync(self) + _la = self._input.LA(1) + if ((((_la - 11)) & ~0x3f) == 0 and ((1 << (_la - 11)) & 8935141971274506753) != 0): + self.state = 267 + self.listaInitializers() + + + self.state = 270 + self.match(zaplangParser.LlaveDer) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ListaInitializersContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def asignacionExpresion(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.AsignacionExpresionContext) + else: + return self.getTypedRuleContext(zaplangParser.AsignacionExpresionContext,i) + + + def Coma(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Coma) + else: + return self.getToken(zaplangParser.Coma, i) + + def getRuleIndex(self): + return zaplangParser.RULE_listaInitializers + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterListaInitializers" ): + listener.enterListaInitializers(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitListaInitializers" ): + listener.exitListaInitializers(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitListaInitializers" ): + return visitor.visitListaInitializers(self) + else: + return visitor.visitChildren(self) + + + + + def listaInitializers(self): + + localctx = zaplangParser.ListaInitializersContext(self, self._ctx, self.state) + self.enterRule(localctx, 40, self.RULE_listaInitializers) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 272 + self.asignacionExpresion() + self.state = 277 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==53: + self.state = 273 + self.match(zaplangParser.Coma) + self.state = 274 + self.asignacionExpresion() + self.state = 279 + self._errHandler.sync(self) + _la = self._input.LA(1) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SentenciaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def sentenciaCompuesta(self): + return self.getTypedRuleContext(zaplangParser.SentenciaCompuestaContext,0) + + + def sentenciaDeclaracion(self): + return self.getTypedRuleContext(zaplangParser.SentenciaDeclaracionContext,0) + + + def sentenciaExpresion(self): + return self.getTypedRuleContext(zaplangParser.SentenciaExpresionContext,0) + + + def sentenciaSeleccion(self): + return self.getTypedRuleContext(zaplangParser.SentenciaSeleccionContext,0) + + + def sentenciaIteracion(self): + return self.getTypedRuleContext(zaplangParser.SentenciaIteracionContext,0) + + + def sentenciaSalto(self): + return self.getTypedRuleContext(zaplangParser.SentenciaSaltoContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_sentencia + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSentencia" ): + listener.enterSentencia(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSentencia" ): + listener.exitSentencia(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSentencia" ): + return visitor.visitSentencia(self) + else: + return visitor.visitChildren(self) + + + + + def sentencia(self): + + localctx = zaplangParser.SentenciaContext(self, self._ctx, self.state) + self.enterRule(localctx, 42, self.RULE_sentencia) + try: + self.state = 286 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,22,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 280 + self.sentenciaCompuesta() + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 281 + self.sentenciaDeclaracion() + pass + + elif la_ == 3: + self.enterOuterAlt(localctx, 3) + self.state = 282 + self.sentenciaExpresion() + pass + + elif la_ == 4: + self.enterOuterAlt(localctx, 4) + self.state = 283 + self.sentenciaSeleccion() + pass + + elif la_ == 5: + self.enterOuterAlt(localctx, 5) + self.state = 284 + self.sentenciaIteracion() + pass + + elif la_ == 6: + self.enterOuterAlt(localctx, 6) + self.state = 285 + self.sentenciaSalto() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SentenciaCompuestaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LlaveIzq(self): + return self.getToken(zaplangParser.LlaveIzq, 0) + + def LlaveDer(self): + return self.getToken(zaplangParser.LlaveDer, 0) + + def sentencia(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.SentenciaContext) + else: + return self.getTypedRuleContext(zaplangParser.SentenciaContext,i) + + + def getRuleIndex(self): + return zaplangParser.RULE_sentenciaCompuesta + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSentenciaCompuesta" ): + listener.enterSentenciaCompuesta(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSentenciaCompuesta" ): + listener.exitSentenciaCompuesta(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSentenciaCompuesta" ): + return visitor.visitSentenciaCompuesta(self) + else: + return visitor.visitChildren(self) + + + + + def sentenciaCompuesta(self): + + localctx = zaplangParser.SentenciaCompuestaContext(self, self._ctx, self.state) + self.enterRule(localctx, 44, self.RULE_sentenciaCompuesta) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 288 + self.match(zaplangParser.LlaveIzq) + self.state = 292 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 5139650221964600) != 0) or ((((_la - 69)) & ~0x3f) == 0 and ((1 << (_la - 69)) & 31) != 0): + self.state = 289 + self.sentencia() + self.state = 294 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 295 + self.match(zaplangParser.LlaveDer) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SentenciaDeclaracionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def declaracionVariable(self): + return self.getTypedRuleContext(zaplangParser.DeclaracionVariableContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_sentenciaDeclaracion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSentenciaDeclaracion" ): + listener.enterSentenciaDeclaracion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSentenciaDeclaracion" ): + listener.exitSentenciaDeclaracion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSentenciaDeclaracion" ): + return visitor.visitSentenciaDeclaracion(self) + else: + return visitor.visitChildren(self) + + + + + def sentenciaDeclaracion(self): + + localctx = zaplangParser.SentenciaDeclaracionContext(self, self._ctx, self.state) + self.enterRule(localctx, 46, self.RULE_sentenciaDeclaracion) + try: + self.enterOuterAlt(localctx, 1) + self.state = 297 + self.declaracionVariable() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SentenciaExpresionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresion(self): + return self.getTypedRuleContext(zaplangParser.ExpresionContext,0) + + + def PuntoYComa(self): + return self.getToken(zaplangParser.PuntoYComa, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_sentenciaExpresion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSentenciaExpresion" ): + listener.enterSentenciaExpresion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSentenciaExpresion" ): + listener.exitSentenciaExpresion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSentenciaExpresion" ): + return visitor.visitSentenciaExpresion(self) + else: + return visitor.visitChildren(self) + + + + + def sentenciaExpresion(self): + + localctx = zaplangParser.SentenciaExpresionContext(self, self._ctx, self.state) + self.enterRule(localctx, 48, self.RULE_sentenciaExpresion) + try: + self.state = 303 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [11, 20, 24, 34, 35, 36, 37, 38, 41, 46, 49, 69, 70, 71, 72, 73]: + self.enterOuterAlt(localctx, 1) + self.state = 299 + self.expresion(0) + self.state = 300 + self.match(zaplangParser.PuntoYComa) + pass + elif token in [52]: + self.enterOuterAlt(localctx, 2) + self.state = 302 + self.match(zaplangParser.PuntoYComa) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SentenciaSeleccionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Si(self): + return self.getToken(zaplangParser.Si, 0) + + def ParenIzq(self): + return self.getToken(zaplangParser.ParenIzq, 0) + + def expresion(self): + return self.getTypedRuleContext(zaplangParser.ExpresionContext,0) + + + def ParenDer(self): + return self.getToken(zaplangParser.ParenDer, 0) + + def sentencia(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.SentenciaContext) + else: + return self.getTypedRuleContext(zaplangParser.SentenciaContext,i) + + + def Sino(self): + return self.getToken(zaplangParser.Sino, 0) + + def Caso(self): + return self.getToken(zaplangParser.Caso, 0) + + def Bul(self): + return self.getToken(zaplangParser.Bul, 0) + + def LlaveIzq(self): + return self.getToken(zaplangParser.LlaveIzq, 0) + + def LlaveDer(self): + return self.getToken(zaplangParser.LlaveDer, 0) + + def casoEtiqueta(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.CasoEtiquetaContext) + else: + return self.getTypedRuleContext(zaplangParser.CasoEtiquetaContext,i) + + + def etiquetaPorDef(self): + return self.getTypedRuleContext(zaplangParser.EtiquetaPorDefContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_sentenciaSeleccion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSentenciaSeleccion" ): + listener.enterSentenciaSeleccion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSentenciaSeleccion" ): + listener.exitSentenciaSeleccion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSentenciaSeleccion" ): + return visitor.visitSentenciaSeleccion(self) + else: + return visitor.visitChildren(self) + + + + + def sentenciaSeleccion(self): + + localctx = zaplangParser.SentenciaSeleccionContext(self, self._ctx, self.state) + self.enterRule(localctx, 50, self.RULE_sentenciaSeleccion) + self._la = 0 # Token type + try: + self.state = 332 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,27,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 305 + self.match(zaplangParser.Si) + self.state = 306 + self.match(zaplangParser.ParenIzq) + self.state = 307 + self.expresion(0) + self.state = 308 + self.match(zaplangParser.ParenDer) + self.state = 309 + self.sentencia() + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 311 + self.match(zaplangParser.Si) + self.state = 312 + self.match(zaplangParser.ParenIzq) + self.state = 313 + self.expresion(0) + self.state = 314 + self.match(zaplangParser.ParenDer) + self.state = 315 + self.sentencia() + self.state = 316 + self.match(zaplangParser.Sino) + self.state = 317 + self.sentencia() + pass + + elif la_ == 3: + self.enterOuterAlt(localctx, 3) + self.state = 319 + self.match(zaplangParser.Caso) + self.state = 320 + self.match(zaplangParser.Bul) + self.state = 321 + self.match(zaplangParser.LlaveIzq) + self.state = 325 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==4: + self.state = 322 + self.casoEtiqueta() + self.state = 327 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 329 + self._errHandler.sync(self) + _la = self._input.LA(1) + if _la==6: + self.state = 328 + self.etiquetaPorDef() + + + self.state = 331 + self.match(zaplangParser.LlaveDer) + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class CasoEtiquetaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Caso(self): + return self.getToken(zaplangParser.Caso, 0) + + def constanteExpresion(self): + return self.getTypedRuleContext(zaplangParser.ConstanteExpresionContext,0) + + + def DosPuntos(self): + return self.getToken(zaplangParser.DosPuntos, 0) + + def sentencia(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.SentenciaContext) + else: + return self.getTypedRuleContext(zaplangParser.SentenciaContext,i) + + + def getRuleIndex(self): + return zaplangParser.RULE_casoEtiqueta + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterCasoEtiqueta" ): + listener.enterCasoEtiqueta(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitCasoEtiqueta" ): + listener.exitCasoEtiqueta(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitCasoEtiqueta" ): + return visitor.visitCasoEtiqueta(self) + else: + return visitor.visitChildren(self) + + + + + def casoEtiqueta(self): + + localctx = zaplangParser.CasoEtiquetaContext(self, self._ctx, self.state) + self.enterRule(localctx, 52, self.RULE_casoEtiqueta) + try: + self.enterOuterAlt(localctx, 1) + self.state = 334 + self.match(zaplangParser.Caso) + self.state = 335 + self.constanteExpresion() + self.state = 336 + self.match(zaplangParser.DosPuntos) + self.state = 340 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,28,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 337 + self.sentencia() + self.state = 342 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,28,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class EtiquetaPorDefContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Pordef(self): + return self.getToken(zaplangParser.Pordef, 0) + + def DosPuntos(self): + return self.getToken(zaplangParser.DosPuntos, 0) + + def sentencia(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.SentenciaContext) + else: + return self.getTypedRuleContext(zaplangParser.SentenciaContext,i) + + + def getRuleIndex(self): + return zaplangParser.RULE_etiquetaPorDef + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterEtiquetaPorDef" ): + listener.enterEtiquetaPorDef(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitEtiquetaPorDef" ): + listener.exitEtiquetaPorDef(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitEtiquetaPorDef" ): + return visitor.visitEtiquetaPorDef(self) + else: + return visitor.visitChildren(self) + + + + + def etiquetaPorDef(self): + + localctx = zaplangParser.EtiquetaPorDefContext(self, self._ctx, self.state) + self.enterRule(localctx, 54, self.RULE_etiquetaPorDef) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 343 + self.match(zaplangParser.Pordef) + self.state = 344 + self.match(zaplangParser.DosPuntos) + self.state = 348 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 5139650221964600) != 0) or ((((_la - 69)) & ~0x3f) == 0 and ((1 << (_la - 69)) & 31) != 0): + self.state = 345 + self.sentencia() + self.state = 350 + self._errHandler.sync(self) + _la = self._input.LA(1) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SentenciaIteracionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Mientras(self): + return self.getToken(zaplangParser.Mientras, 0) + + def ParenIzq(self): + return self.getToken(zaplangParser.ParenIzq, 0) + + def expresion(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.ExpresionContext) + else: + return self.getTypedRuleContext(zaplangParser.ExpresionContext,i) + + + def ParenDer(self): + return self.getToken(zaplangParser.ParenDer, 0) + + def sentencia(self): + return self.getTypedRuleContext(zaplangParser.SentenciaContext,0) + + + def Por(self): + return self.getToken(zaplangParser.Por, 0) + + def PuntoYComa(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.PuntoYComa) + else: + return self.getToken(zaplangParser.PuntoYComa, i) + + def sentenciaExpresion(self): + return self.getTypedRuleContext(zaplangParser.SentenciaExpresionContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_sentenciaIteracion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSentenciaIteracion" ): + listener.enterSentenciaIteracion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSentenciaIteracion" ): + listener.exitSentenciaIteracion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSentenciaIteracion" ): + return visitor.visitSentenciaIteracion(self) + else: + return visitor.visitChildren(self) + + + + + def sentenciaIteracion(self): + + localctx = zaplangParser.SentenciaIteracionContext(self, self._ctx, self.state) + self.enterRule(localctx, 56, self.RULE_sentenciaIteracion) + self._la = 0 # Token type + try: + self.state = 372 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [23]: + self.enterOuterAlt(localctx, 1) + self.state = 351 + self.match(zaplangParser.Mientras) + self.state = 352 + self.match(zaplangParser.ParenIzq) + self.state = 353 + self.expresion(0) + self.state = 354 + self.match(zaplangParser.ParenDer) + self.state = 355 + self.sentencia() + pass + elif token in [13]: + self.enterOuterAlt(localctx, 2) + self.state = 357 + self.match(zaplangParser.Por) + self.state = 358 + self.match(zaplangParser.ParenIzq) + self.state = 360 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,30,self._ctx) + if la_ == 1: + self.state = 359 + self.sentenciaExpresion() + + + self.state = 362 + self.match(zaplangParser.PuntoYComa) + self.state = 364 + self._errHandler.sync(self) + _la = self._input.LA(1) + if ((((_la - 11)) & ~0x3f) == 0 and ((1 << (_la - 11)) & 8935141971274506753) != 0): + self.state = 363 + self.expresion(0) + + + self.state = 366 + self.match(zaplangParser.PuntoYComa) + self.state = 368 + self._errHandler.sync(self) + _la = self._input.LA(1) + if ((((_la - 11)) & ~0x3f) == 0 and ((1 << (_la - 11)) & 8935141971274506753) != 0): + self.state = 367 + self.expresion(0) + + + self.state = 370 + self.match(zaplangParser.ParenDer) + self.state = 371 + self.sentencia() + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class SentenciaSaltoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Retornar(self): + return self.getToken(zaplangParser.Retornar, 0) + + def PuntoYComa(self): + return self.getToken(zaplangParser.PuntoYComa, 0) + + def expresion(self): + return self.getTypedRuleContext(zaplangParser.ExpresionContext,0) + + + def Fin(self): + return self.getToken(zaplangParser.Fin, 0) + + def Interrup(self): + return self.getToken(zaplangParser.Interrup, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_sentenciaSalto + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterSentenciaSalto" ): + listener.enterSentenciaSalto(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitSentenciaSalto" ): + listener.exitSentenciaSalto(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitSentenciaSalto" ): + return visitor.visitSentenciaSalto(self) + else: + return visitor.visitChildren(self) + + + + + def sentenciaSalto(self): + + localctx = zaplangParser.SentenciaSaltoContext(self, self._ctx, self.state) + self.enterRule(localctx, 58, self.RULE_sentenciaSalto) + self._la = 0 # Token type + try: + self.state = 383 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [16]: + self.enterOuterAlt(localctx, 1) + self.state = 374 + self.match(zaplangParser.Retornar) + self.state = 376 + self._errHandler.sync(self) + _la = self._input.LA(1) + if ((((_la - 11)) & ~0x3f) == 0 and ((1 << (_la - 11)) & 8935141971274506753) != 0): + self.state = 375 + self.expresion(0) + + + self.state = 378 + self.match(zaplangParser.PuntoYComa) + pass + elif token in [3]: + self.enterOuterAlt(localctx, 2) + self.state = 379 + self.match(zaplangParser.Fin) + self.state = 380 + self.match(zaplangParser.PuntoYComa) + pass + elif token in [19]: + self.enterOuterAlt(localctx, 3) + self.state = 381 + self.match(zaplangParser.Interrup) + self.state = 382 + self.match(zaplangParser.PuntoYComa) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class BloqueContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def LlaveIzq(self): + return self.getToken(zaplangParser.LlaveIzq, 0) + + def LlaveDer(self): + return self.getToken(zaplangParser.LlaveDer, 0) + + def declaracionVariable(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.DeclaracionVariableContext) + else: + return self.getTypedRuleContext(zaplangParser.DeclaracionVariableContext,i) + + + def sentencia(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.SentenciaContext) + else: + return self.getTypedRuleContext(zaplangParser.SentenciaContext,i) + + + def getRuleIndex(self): + return zaplangParser.RULE_bloque + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterBloque" ): + listener.enterBloque(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitBloque" ): + listener.exitBloque(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitBloque" ): + return visitor.visitBloque(self) + else: + return visitor.visitChildren(self) + + + + + def bloque(self): + + localctx = zaplangParser.BloqueContext(self, self._ctx, self.state) + self.enterRule(localctx, 60, self.RULE_bloque) + self._la = 0 # Token type + try: + self.state = 400 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,38,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 385 + self.match(zaplangParser.LlaveIzq) + self.state = 389 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,36,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 386 + self.declaracionVariable() + self.state = 391 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,36,self._ctx) + + self.state = 395 + self._errHandler.sync(self) + _la = self._input.LA(1) + while (((_la) & ~0x3f) == 0 and ((1 << _la) & 5139650221964600) != 0) or ((((_la - 69)) & ~0x3f) == 0 and ((1 << (_la - 69)) & 31) != 0): + self.state = 392 + self.sentencia() + self.state = 397 + self._errHandler.sync(self) + _la = self._input.LA(1) + + self.state = 398 + self.match(zaplangParser.LlaveDer) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 399 + self.sentencia() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def asignacionExpresion(self): + return self.getTypedRuleContext(zaplangParser.AsignacionExpresionContext,0) + + + def expresion(self): + return self.getTypedRuleContext(zaplangParser.ExpresionContext,0) + + + def Coma(self): + return self.getToken(zaplangParser.Coma, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_expresion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresion" ): + listener.enterExpresion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresion" ): + listener.exitExpresion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresion" ): + return visitor.visitExpresion(self) + else: + return visitor.visitChildren(self) + + + + def expresion(self, _p:int=0): + _parentctx = self._ctx + _parentState = self.state + localctx = zaplangParser.ExpresionContext(self, self._ctx, _parentState) + _prevctx = localctx + _startState = 62 + self.enterRecursionRule(localctx, 62, self.RULE_expresion, _p) + try: + self.enterOuterAlt(localctx, 1) + self.state = 403 + self.asignacionExpresion() + self._ctx.stop = self._input.LT(-1) + self.state = 410 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,39,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + if self._parseListeners is not None: + self.triggerExitRuleEvent() + _prevctx = localctx + localctx = zaplangParser.ExpresionContext(self, _parentctx, _parentState) + self.pushNewRecursionContext(localctx, _startState, self.RULE_expresion) + self.state = 405 + if not self.precpred(self._ctx, 1): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") + self.state = 406 + self.match(zaplangParser.Coma) + self.state = 407 + self.asignacionExpresion() + self.state = 412 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,39,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.unrollRecursionContexts(_parentctx) + return localctx + + + class AsignacionExpresionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionCondicional(self): + return self.getTypedRuleContext(zaplangParser.ExpresionCondicionalContext,0) + + + def expresionUnaria(self): + return self.getTypedRuleContext(zaplangParser.ExpresionUnariaContext,0) + + + def operadorAsignacion(self): + return self.getTypedRuleContext(zaplangParser.OperadorAsignacionContext,0) + + + def asignacionExpresion(self): + return self.getTypedRuleContext(zaplangParser.AsignacionExpresionContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_asignacionExpresion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterAsignacionExpresion" ): + listener.enterAsignacionExpresion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitAsignacionExpresion" ): + listener.exitAsignacionExpresion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitAsignacionExpresion" ): + return visitor.visitAsignacionExpresion(self) + else: + return visitor.visitChildren(self) + + + + + def asignacionExpresion(self): + + localctx = zaplangParser.AsignacionExpresionContext(self, self._ctx, self.state) + self.enterRule(localctx, 64, self.RULE_asignacionExpresion) + try: + self.state = 418 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,40,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 413 + self.expresionCondicional() + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 414 + self.expresionUnaria() + self.state = 415 + self.operadorAsignacion() + self.state = 416 + self.asignacionExpresion() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class OperadorAsignacionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Asignar(self): + return self.getToken(zaplangParser.Asignar, 0) + + def MasAsignacion(self): + return self.getToken(zaplangParser.MasAsignacion, 0) + + def MenosAsignacion(self): + return self.getToken(zaplangParser.MenosAsignacion, 0) + + def EstrellaAsignacion(self): + return self.getToken(zaplangParser.EstrellaAsignacion, 0) + + def DivAsignacion(self): + return self.getToken(zaplangParser.DivAsignacion, 0) + + def ModAsignacion(self): + return self.getToken(zaplangParser.ModAsignacion, 0) + + def DesplazIzqAsignacion(self): + return self.getToken(zaplangParser.DesplazIzqAsignacion, 0) + + def DesplazDerAsignacion(self): + return self.getToken(zaplangParser.DesplazDerAsignacion, 0) + + def YAsignacion(self): + return self.getToken(zaplangParser.YAsignacion, 0) + + def XorAsignacion(self): + return self.getToken(zaplangParser.XorAsignacion, 0) + + def OAsignacion(self): + return self.getToken(zaplangParser.OAsignacion, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_operadorAsignacion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterOperadorAsignacion" ): + listener.enterOperadorAsignacion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitOperadorAsignacion" ): + listener.exitOperadorAsignacion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitOperadorAsignacion" ): + return visitor.visitOperadorAsignacion(self) + else: + return visitor.visitChildren(self) + + + + + def operadorAsignacion(self): + + localctx = zaplangParser.OperadorAsignacionContext(self, self._ctx, self.state) + self.enterRule(localctx, 66, self.RULE_operadorAsignacion) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 420 + _la = self._input.LA(1) + if not(((((_la - 54)) & ~0x3f) == 0 and ((1 << (_la - 54)) & 2047) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionCondicionalContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionLogicaO(self): + return self.getTypedRuleContext(zaplangParser.ExpresionLogicaOContext,0) + + + def Pregunta(self): + return self.getToken(zaplangParser.Pregunta, 0) + + def expresion(self): + return self.getTypedRuleContext(zaplangParser.ExpresionContext,0) + + + def DosPuntos(self): + return self.getToken(zaplangParser.DosPuntos, 0) + + def expresionCondicional(self): + return self.getTypedRuleContext(zaplangParser.ExpresionCondicionalContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_expresionCondicional + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionCondicional" ): + listener.enterExpresionCondicional(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionCondicional" ): + listener.exitExpresionCondicional(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionCondicional" ): + return visitor.visitExpresionCondicional(self) + else: + return visitor.visitChildren(self) + + + + + def expresionCondicional(self): + + localctx = zaplangParser.ExpresionCondicionalContext(self, self._ctx, self.state) + self.enterRule(localctx, 68, self.RULE_expresionCondicional) + try: + self.state = 429 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,41,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 422 + self.expresionLogicaO() + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 423 + self.expresionLogicaO() + self.state = 424 + self.match(zaplangParser.Pregunta) + self.state = 425 + self.expresion(0) + self.state = 426 + self.match(zaplangParser.DosPuntos) + self.state = 427 + self.expresionCondicional() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionLogicaOContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionLogicaY(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.ExpresionLogicaYContext) + else: + return self.getTypedRuleContext(zaplangParser.ExpresionLogicaYContext,i) + + + def OO(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.OO) + else: + return self.getToken(zaplangParser.OO, i) + + def getRuleIndex(self): + return zaplangParser.RULE_expresionLogicaO + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionLogicaO" ): + listener.enterExpresionLogicaO(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionLogicaO" ): + listener.exitExpresionLogicaO(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionLogicaO" ): + return visitor.visitExpresionLogicaO(self) + else: + return visitor.visitChildren(self) + + + + + def expresionLogicaO(self): + + localctx = zaplangParser.ExpresionLogicaOContext(self, self._ctx, self.state) + self.enterRule(localctx, 70, self.RULE_expresionLogicaO) + try: + self.enterOuterAlt(localctx, 1) + self.state = 431 + self.expresionLogicaY() + self.state = 436 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,42,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 432 + self.match(zaplangParser.OO) + self.state = 433 + self.expresionLogicaY() + self.state = 438 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,42,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionLogicaYContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionIgualacion(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.ExpresionIgualacionContext) + else: + return self.getTypedRuleContext(zaplangParser.ExpresionIgualacionContext,i) + + + def YY(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.YY) + else: + return self.getToken(zaplangParser.YY, i) + + def getRuleIndex(self): + return zaplangParser.RULE_expresionLogicaY + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionLogicaY" ): + listener.enterExpresionLogicaY(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionLogicaY" ): + listener.exitExpresionLogicaY(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionLogicaY" ): + return visitor.visitExpresionLogicaY(self) + else: + return visitor.visitChildren(self) + + + + + def expresionLogicaY(self): + + localctx = zaplangParser.ExpresionLogicaYContext(self, self._ctx, self.state) + self.enterRule(localctx, 72, self.RULE_expresionLogicaY) + try: + self.enterOuterAlt(localctx, 1) + self.state = 439 + self.expresionIgualacion() + self.state = 444 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,43,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 440 + self.match(zaplangParser.YY) + self.state = 441 + self.expresionIgualacion() + self.state = 446 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,43,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionIgualacionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionRelacional(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.ExpresionRelacionalContext) + else: + return self.getTypedRuleContext(zaplangParser.ExpresionRelacionalContext,i) + + + def Igual(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Igual) + else: + return self.getToken(zaplangParser.Igual, i) + + def Diferente(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Diferente) + else: + return self.getToken(zaplangParser.Diferente, i) + + def getRuleIndex(self): + return zaplangParser.RULE_expresionIgualacion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionIgualacion" ): + listener.enterExpresionIgualacion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionIgualacion" ): + listener.exitExpresionIgualacion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionIgualacion" ): + return visitor.visitExpresionIgualacion(self) + else: + return visitor.visitChildren(self) + + + + + def expresionIgualacion(self): + + localctx = zaplangParser.ExpresionIgualacionContext(self, self._ctx, self.state) + self.enterRule(localctx, 74, self.RULE_expresionIgualacion) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 447 + self.expresionRelacional() + self.state = 452 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,44,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 448 + _la = self._input.LA(1) + if not(_la==65 or _la==66): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 449 + self.expresionRelacional() + self.state = 454 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,44,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionRelacionalContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionDesplazamiento(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.ExpresionDesplazamientoContext) + else: + return self.getTypedRuleContext(zaplangParser.ExpresionDesplazamientoContext,i) + + + def MenorQue(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.MenorQue) + else: + return self.getToken(zaplangParser.MenorQue, i) + + def MayorQue(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.MayorQue) + else: + return self.getToken(zaplangParser.MayorQue, i) + + def MenorOIgualQue(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.MenorOIgualQue) + else: + return self.getToken(zaplangParser.MenorOIgualQue, i) + + def MayorOIgualQue(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.MayorOIgualQue) + else: + return self.getToken(zaplangParser.MayorOIgualQue, i) + + def getRuleIndex(self): + return zaplangParser.RULE_expresionRelacional + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionRelacional" ): + listener.enterExpresionRelacional(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionRelacional" ): + listener.exitExpresionRelacional(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionRelacional" ): + return visitor.visitExpresionRelacional(self) + else: + return visitor.visitChildren(self) + + + + + def expresionRelacional(self): + + localctx = zaplangParser.ExpresionRelacionalContext(self, self._ctx, self.state) + self.enterRule(localctx, 76, self.RULE_expresionRelacional) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 455 + self.expresionDesplazamiento() + self.state = 460 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,45,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 456 + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 16106127360) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 457 + self.expresionDesplazamiento() + self.state = 462 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,45,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionDesplazamientoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionAditiva(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.ExpresionAditivaContext) + else: + return self.getTypedRuleContext(zaplangParser.ExpresionAditivaContext,i) + + + def DesplazIzq(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.DesplazIzq) + else: + return self.getToken(zaplangParser.DesplazIzq, i) + + def DesplazDer(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.DesplazDer) + else: + return self.getToken(zaplangParser.DesplazDer, i) + + def getRuleIndex(self): + return zaplangParser.RULE_expresionDesplazamiento + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionDesplazamiento" ): + listener.enterExpresionDesplazamiento(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionDesplazamiento" ): + listener.exitExpresionDesplazamiento(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionDesplazamiento" ): + return visitor.visitExpresionDesplazamiento(self) + else: + return visitor.visitChildren(self) + + + + + def expresionDesplazamiento(self): + + localctx = zaplangParser.ExpresionDesplazamientoContext(self, self._ctx, self.state) + self.enterRule(localctx, 78, self.RULE_expresionDesplazamiento) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 463 + self.expresionAditiva() + self.state = 468 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,46,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 464 + _la = self._input.LA(1) + if not(_la==43 or _la==44): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 465 + self.expresionAditiva() + self.state = 470 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,46,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionAditivaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionMultiplicativa(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.ExpresionMultiplicativaContext) + else: + return self.getTypedRuleContext(zaplangParser.ExpresionMultiplicativaContext,i) + + + def Mas(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Mas) + else: + return self.getToken(zaplangParser.Mas, i) + + def Menos(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Menos) + else: + return self.getToken(zaplangParser.Menos, i) + + def getRuleIndex(self): + return zaplangParser.RULE_expresionAditiva + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionAditiva" ): + listener.enterExpresionAditiva(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionAditiva" ): + listener.exitExpresionAditiva(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionAditiva" ): + return visitor.visitExpresionAditiva(self) + else: + return visitor.visitChildren(self) + + + + + def expresionAditiva(self): + + localctx = zaplangParser.ExpresionAditivaContext(self, self._ctx, self.state) + self.enterRule(localctx, 80, self.RULE_expresionAditiva) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 471 + self.expresionMultiplicativa() + self.state = 476 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,47,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 472 + _la = self._input.LA(1) + if not(_la==34 or _la==36): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 473 + self.expresionMultiplicativa() + self.state = 478 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,47,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionMultiplicativaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionUnaria(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.ExpresionUnariaContext) + else: + return self.getTypedRuleContext(zaplangParser.ExpresionUnariaContext,i) + + + def Estrella(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Estrella) + else: + return self.getToken(zaplangParser.Estrella, i) + + def Div(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Div) + else: + return self.getToken(zaplangParser.Div, i) + + def Mod(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Mod) + else: + return self.getToken(zaplangParser.Mod, i) + + def getRuleIndex(self): + return zaplangParser.RULE_expresionMultiplicativa + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionMultiplicativa" ): + listener.enterExpresionMultiplicativa(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionMultiplicativa" ): + listener.exitExpresionMultiplicativa(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionMultiplicativa" ): + return visitor.visitExpresionMultiplicativa(self) + else: + return visitor.visitChildren(self) + + + + + def expresionMultiplicativa(self): + + localctx = zaplangParser.ExpresionMultiplicativaContext(self, self._ctx, self.state) + self.enterRule(localctx, 82, self.RULE_expresionMultiplicativa) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 479 + self.expresionUnaria() + self.state = 484 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,48,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + self.state = 480 + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 1924145348608) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + self.state = 481 + self.expresionUnaria() + self.state = 486 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,48,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionUnariaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def operadorUnario(self): + return self.getTypedRuleContext(zaplangParser.OperadorUnarioContext,0) + + + def expresionUnaria(self): + return self.getTypedRuleContext(zaplangParser.ExpresionUnariaContext,0) + + + def expresionPostfija(self): + return self.getTypedRuleContext(zaplangParser.ExpresionPostfijaContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_expresionUnaria + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionUnaria" ): + listener.enterExpresionUnaria(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionUnaria" ): + listener.exitExpresionUnaria(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionUnaria" ): + return visitor.visitExpresionUnaria(self) + else: + return visitor.visitChildren(self) + + + + + def expresionUnaria(self): + + localctx = zaplangParser.ExpresionUnariaContext(self, self._ctx, self.state) + self.enterRule(localctx, 84, self.RULE_expresionUnaria) + try: + self.state = 491 + self._errHandler.sync(self) + token = self._input.LA(1) + if token in [34, 35, 36, 37, 38, 41, 46, 49]: + self.enterOuterAlt(localctx, 1) + self.state = 487 + self.operadorUnario() + self.state = 488 + self.expresionUnaria() + pass + elif token in [11, 20, 24, 69, 70, 71, 72, 73]: + self.enterOuterAlt(localctx, 2) + self.state = 490 + self.expresionPostfija(0) + pass + else: + raise NoViableAltException(self) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class OperadorUnarioContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Y(self): + return self.getToken(zaplangParser.Y, 0) + + def Estrella(self): + return self.getToken(zaplangParser.Estrella, 0) + + def Mas(self): + return self.getToken(zaplangParser.Mas, 0) + + def Menos(self): + return self.getToken(zaplangParser.Menos, 0) + + def Complemento(self): + return self.getToken(zaplangParser.Complemento, 0) + + def Not(self): + return self.getToken(zaplangParser.Not, 0) + + def MasMas(self): + return self.getToken(zaplangParser.MasMas, 0) + + def MenosMenos(self): + return self.getToken(zaplangParser.MenosMenos, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_operadorUnario + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterOperadorUnario" ): + listener.enterOperadorUnario(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitOperadorUnario" ): + listener.exitOperadorUnario(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitOperadorUnario" ): + return visitor.visitOperadorUnario(self) + else: + return visitor.visitChildren(self) + + + + + def operadorUnario(self): + + localctx = zaplangParser.OperadorUnarioContext(self, self._ctx, self.state) + self.enterRule(localctx, 86, self.RULE_operadorUnario) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 493 + _la = self._input.LA(1) + if not((((_la) & ~0x3f) == 0 and ((1 << _la) & 636050296799232) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ExpresionPostfijaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def expresionPrimaria(self): + return self.getTypedRuleContext(zaplangParser.ExpresionPrimariaContext,0) + + + def expresionPostfija(self): + return self.getTypedRuleContext(zaplangParser.ExpresionPostfijaContext,0) + + + def CorcheteIzq(self): + return self.getToken(zaplangParser.CorcheteIzq, 0) + + def expresion(self): + return self.getTypedRuleContext(zaplangParser.ExpresionContext,0) + + + def CorcheteDer(self): + return self.getToken(zaplangParser.CorcheteDer, 0) + + def ParenIzq(self): + return self.getToken(zaplangParser.ParenIzq, 0) + + def ParenDer(self): + return self.getToken(zaplangParser.ParenDer, 0) + + def listaArgumentos(self): + return self.getTypedRuleContext(zaplangParser.ListaArgumentosContext,0) + + + def Punto(self): + return self.getToken(zaplangParser.Punto, 0) + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def Flecha(self): + return self.getToken(zaplangParser.Flecha, 0) + + def MasMas(self): + return self.getToken(zaplangParser.MasMas, 0) + + def MenosMenos(self): + return self.getToken(zaplangParser.MenosMenos, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_expresionPostfija + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionPostfija" ): + listener.enterExpresionPostfija(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionPostfija" ): + listener.exitExpresionPostfija(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionPostfija" ): + return visitor.visitExpresionPostfija(self) + else: + return visitor.visitChildren(self) + + + + def expresionPostfija(self, _p:int=0): + _parentctx = self._ctx + _parentState = self.state + localctx = zaplangParser.ExpresionPostfijaContext(self, self._ctx, _parentState) + _prevctx = localctx + _startState = 88 + self.enterRecursionRule(localctx, 88, self.RULE_expresionPostfija, _p) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 496 + self.expresionPrimaria() + self._ctx.stop = self._input.LT(-1) + self.state = 521 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,52,self._ctx) + while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: + if _alt==1: + if self._parseListeners is not None: + self.triggerExitRuleEvent() + _prevctx = localctx + self.state = 519 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,51,self._ctx) + if la_ == 1: + localctx = zaplangParser.ExpresionPostfijaContext(self, _parentctx, _parentState) + self.pushNewRecursionContext(localctx, _startState, self.RULE_expresionPostfija) + self.state = 498 + if not self.precpred(self._ctx, 6): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 6)") + self.state = 499 + self.match(zaplangParser.CorcheteIzq) + self.state = 500 + self.expresion(0) + self.state = 501 + self.match(zaplangParser.CorcheteDer) + pass + + elif la_ == 2: + localctx = zaplangParser.ExpresionPostfijaContext(self, _parentctx, _parentState) + self.pushNewRecursionContext(localctx, _startState, self.RULE_expresionPostfija) + self.state = 503 + if not self.precpred(self._ctx, 5): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 5)") + self.state = 504 + self.match(zaplangParser.ParenIzq) + self.state = 506 + self._errHandler.sync(self) + _la = self._input.LA(1) + if ((((_la - 11)) & ~0x3f) == 0 and ((1 << (_la - 11)) & 8935141971274506753) != 0): + self.state = 505 + self.listaArgumentos() + + + self.state = 508 + self.match(zaplangParser.ParenDer) + pass + + elif la_ == 3: + localctx = zaplangParser.ExpresionPostfijaContext(self, _parentctx, _parentState) + self.pushNewRecursionContext(localctx, _startState, self.RULE_expresionPostfija) + self.state = 509 + if not self.precpred(self._ctx, 4): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 4)") + self.state = 510 + self.match(zaplangParser.Punto) + self.state = 511 + self.match(zaplangParser.Identificador) + pass + + elif la_ == 4: + localctx = zaplangParser.ExpresionPostfijaContext(self, _parentctx, _parentState) + self.pushNewRecursionContext(localctx, _startState, self.RULE_expresionPostfija) + self.state = 512 + if not self.precpred(self._ctx, 3): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") + self.state = 513 + self.match(zaplangParser.Flecha) + self.state = 514 + self.match(zaplangParser.Identificador) + pass + + elif la_ == 5: + localctx = zaplangParser.ExpresionPostfijaContext(self, _parentctx, _parentState) + self.pushNewRecursionContext(localctx, _startState, self.RULE_expresionPostfija) + self.state = 515 + if not self.precpred(self._ctx, 2): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") + self.state = 516 + self.match(zaplangParser.MasMas) + pass + + elif la_ == 6: + localctx = zaplangParser.ExpresionPostfijaContext(self, _parentctx, _parentState) + self.pushNewRecursionContext(localctx, _startState, self.RULE_expresionPostfija) + self.state = 517 + if not self.precpred(self._ctx, 1): + from antlr4.error.Errors import FailedPredicateException + raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") + self.state = 518 + self.match(zaplangParser.MenosMenos) + pass + + + self.state = 523 + self._errHandler.sync(self) + _alt = self._interp.adaptivePredict(self._input,52,self._ctx) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.unrollRecursionContexts(_parentctx) + return localctx + + + class ExpresionPrimariaContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Identificador(self): + return self.getToken(zaplangParser.Identificador, 0) + + def constanteExpresion(self): + return self.getTypedRuleContext(zaplangParser.ConstanteExpresionContext,0) + + + def CadenaLiteral(self): + return self.getToken(zaplangParser.CadenaLiteral, 0) + + def ParenIzq(self): + return self.getToken(zaplangParser.ParenIzq, 0) + + def expresion(self): + return self.getTypedRuleContext(zaplangParser.ExpresionContext,0) + + + def ParenDer(self): + return self.getToken(zaplangParser.ParenDer, 0) + + def especificadorTipo(self): + return self.getTypedRuleContext(zaplangParser.EspecificadorTipoContext,0) + + + def expresionUnaria(self): + return self.getTypedRuleContext(zaplangParser.ExpresionUnariaContext,0) + + + def getRuleIndex(self): + return zaplangParser.RULE_expresionPrimaria + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterExpresionPrimaria" ): + listener.enterExpresionPrimaria(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitExpresionPrimaria" ): + listener.exitExpresionPrimaria(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitExpresionPrimaria" ): + return visitor.visitExpresionPrimaria(self) + else: + return visitor.visitChildren(self) + + + + + def expresionPrimaria(self): + + localctx = zaplangParser.ExpresionPrimariaContext(self, self._ctx, self.state) + self.enterRule(localctx, 90, self.RULE_expresionPrimaria) + try: + self.state = 536 + self._errHandler.sync(self) + la_ = self._interp.adaptivePredict(self._input,53,self._ctx) + if la_ == 1: + self.enterOuterAlt(localctx, 1) + self.state = 524 + self.match(zaplangParser.Identificador) + pass + + elif la_ == 2: + self.enterOuterAlt(localctx, 2) + self.state = 525 + self.constanteExpresion() + pass + + elif la_ == 3: + self.enterOuterAlt(localctx, 3) + self.state = 526 + self.match(zaplangParser.CadenaLiteral) + pass + + elif la_ == 4: + self.enterOuterAlt(localctx, 4) + self.state = 527 + self.match(zaplangParser.ParenIzq) + self.state = 528 + self.expresion(0) + self.state = 529 + self.match(zaplangParser.ParenDer) + pass + + elif la_ == 5: + self.enterOuterAlt(localctx, 5) + self.state = 531 + self.match(zaplangParser.ParenIzq) + self.state = 532 + self.especificadorTipo() + self.state = 533 + self.match(zaplangParser.ParenDer) + self.state = 534 + self.expresionUnaria() + pass + + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ConstanteExpresionContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def ConstanteEntera(self): + return self.getToken(zaplangParser.ConstanteEntera, 0) + + def ConstanteFlotante(self): + return self.getToken(zaplangParser.ConstanteFlotante, 0) + + def ConstanteCaracteres(self): + return self.getToken(zaplangParser.ConstanteCaracteres, 0) + + def Verdadero(self): + return self.getToken(zaplangParser.Verdadero, 0) + + def Falso(self): + return self.getToken(zaplangParser.Falso, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_constanteExpresion + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterConstanteExpresion" ): + listener.enterConstanteExpresion(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitConstanteExpresion" ): + listener.exitConstanteExpresion(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitConstanteExpresion" ): + return visitor.visitConstanteExpresion(self) + else: + return visitor.visitChildren(self) + + + + + def constanteExpresion(self): + + localctx = zaplangParser.ConstanteExpresionContext(self, self._ctx, self.state) + self.enterRule(localctx, 92, self.RULE_constanteExpresion) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 538 + _la = self._input.LA(1) + if not(((((_la - 11)) & ~0x3f) == 0 and ((1 << (_la - 11)) & 4035225266123964929) != 0)): + self._errHandler.recoverInline(self) + else: + self._errHandler.reportMatch(self) + self.consume() + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class ListaArgumentosContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def asignacionExpresion(self, i:int=None): + if i is None: + return self.getTypedRuleContexts(zaplangParser.AsignacionExpresionContext) + else: + return self.getTypedRuleContext(zaplangParser.AsignacionExpresionContext,i) + + + def Coma(self, i:int=None): + if i is None: + return self.getTokens(zaplangParser.Coma) + else: + return self.getToken(zaplangParser.Coma, i) + + def getRuleIndex(self): + return zaplangParser.RULE_listaArgumentos + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterListaArgumentos" ): + listener.enterListaArgumentos(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitListaArgumentos" ): + listener.exitListaArgumentos(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitListaArgumentos" ): + return visitor.visitListaArgumentos(self) + else: + return visitor.visitChildren(self) + + + + + def listaArgumentos(self): + + localctx = zaplangParser.ListaArgumentosContext(self, self._ctx, self.state) + self.enterRule(localctx, 94, self.RULE_listaArgumentos) + self._la = 0 # Token type + try: + self.enterOuterAlt(localctx, 1) + self.state = 540 + self.asignacionExpresion() + self.state = 545 + self._errHandler.sync(self) + _la = self._input.LA(1) + while _la==53: + self.state = 541 + self.match(zaplangParser.Coma) + self.state = 542 + self.asignacionExpresion() + self.state = 547 + self._errHandler.sync(self) + _la = self._input.LA(1) + + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + class MarcaPuntoContext(ParserRuleContext): + __slots__ = 'parser' + + def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): + super().__init__(parent, invokingState) + self.parser = parser + + def Bul(self): + return self.getToken(zaplangParser.Bul, 0) + + def getRuleIndex(self): + return zaplangParser.RULE_marcaPunto + + def enterRule(self, listener:ParseTreeListener): + if hasattr( listener, "enterMarcaPunto" ): + listener.enterMarcaPunto(self) + + def exitRule(self, listener:ParseTreeListener): + if hasattr( listener, "exitMarcaPunto" ): + listener.exitMarcaPunto(self) + + def accept(self, visitor:ParseTreeVisitor): + if hasattr( visitor, "visitMarcaPunto" ): + return visitor.visitMarcaPunto(self) + else: + return visitor.visitChildren(self) + + + + + def marcaPunto(self): + + localctx = zaplangParser.MarcaPuntoContext(self, self._ctx, self.state) + self.enterRule(localctx, 96, self.RULE_marcaPunto) + try: + self.enterOuterAlt(localctx, 1) + self.state = 548 + self.match(zaplangParser.Bul) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + + + + def sempred(self, localctx:RuleContext, ruleIndex:int, predIndex:int): + if self._predicates == None: + self._predicates = dict() + self._predicates[31] = self.expresion_sempred + self._predicates[44] = self.expresionPostfija_sempred + pred = self._predicates.get(ruleIndex, None) + if pred is None: + raise Exception("No predicate with index:" + str(ruleIndex)) + else: + return pred(localctx, predIndex) + + def expresion_sempred(self, localctx:ExpresionContext, predIndex:int): + if predIndex == 0: + return self.precpred(self._ctx, 1) + + + def expresionPostfija_sempred(self, localctx:ExpresionPostfijaContext, predIndex:int): + if predIndex == 1: + return self.precpred(self._ctx, 6) + + + if predIndex == 2: + return self.precpred(self._ctx, 5) + + + if predIndex == 3: + return self.precpred(self._ctx, 4) + + + if predIndex == 4: + return self.precpred(self._ctx, 3) + + + if predIndex == 5: + return self.precpred(self._ctx, 2) + + + if predIndex == 6: + return self.precpred(self._ctx, 1) + + + + + diff --git a/zaplangParser.tokens b/zaplangParser.tokens new file mode 100644 index 0000000..06a48c0 --- /dev/null +++ b/zaplangParser.tokens @@ -0,0 +1,146 @@ +Bul=1 +Func=2 +Fin=3 +Caso=4 +Carac=5 +Pordef=6 +Hacer=7 +Doble=8 +Sino=9 +Enum=10 +Falso=11 +Flot=12 +Por=13 +Si=14 +Ent=15 +Retornar=16 +ConFirma=17 +Estruct=18 +Interrup=19 +Verdadero=20 +SinFirma=21 +Vacio=22 +Mientras=23 +ParenIzq=24 +ParenDer=25 +CorcheteIzq=26 +CorcheteDer=27 +LlaveIzq=28 +LlaveDer=29 +MenorQue=30 +MenorOIgualQue=31 +MayorQue=32 +MayorOIgualQue=33 +Mas=34 +MasMas=35 +Menos=36 +MenosMenos=37 +Estrella=38 +Div=39 +Mod=40 +Y=41 +O=42 +DesplazIzq=43 +DesplazDer=44 +Xor=45 +Complemento=46 +YY=47 +OO=48 +Not=49 +Pregunta=50 +DosPuntos=51 +PuntoYComa=52 +Coma=53 +Asignar=54 +EstrellaAsignacion=55 +DivAsignacion=56 +ModAsignacion=57 +MasAsignacion=58 +MenosAsignacion=59 +YAsignacion=60 +OAsignacion=61 +DesplazIzqAsignacion=62 +DesplazDerAsignacion=63 +XorAsignacion=64 +Igual=65 +Diferente=66 +Flecha=67 +Punto=68 +Identificador=69 +ConstanteEntera=70 +ConstanteFlotante=71 +ConstanteCaracteres=72 +CadenaLiteral=73 +Whitespace=74 +Newline=75 +BlockComment=76 +LineComment=77 +LineCommentHash=78 +'bul'=1 +'func'=2 +'fin'=3 +'caso'=4 +'carac'=5 +'pordef'=6 +'hacer'=7 +'doble'=8 +'sino'=9 +'enum'=10 +'falso'=11 +'flot'=12 +'por'=13 +'si'=14 +'Ent'=15 +'retornar'=16 +'cf'=17 +'estruct'=18 +'interrup'=19 +'verdadero'=20 +'sf'=21 +'vacio'=22 +'mientras'=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 diff --git a/zaplangParserListener.py b/zaplangParserListener.py new file mode 100644 index 0000000..06b7842 --- /dev/null +++ b/zaplangParserListener.py @@ -0,0 +1,453 @@ +# Generated from zaplangParser.g4 by ANTLR 4.13.2 +from antlr4 import * +if "." in __name__: + from .zaplangParser import zaplangParser +else: + from zaplangParser import zaplangParser + +# This class defines a complete listener for a parse tree produced by zaplangParser. +class zaplangParserListener(ParseTreeListener): + + # Enter a parse tree produced by zaplangParser#unidadTraduccion. + def enterUnidadTraduccion(self, ctx:zaplangParser.UnidadTraduccionContext): + pass + + # Exit a parse tree produced by zaplangParser#unidadTraduccion. + def exitUnidadTraduccion(self, ctx:zaplangParser.UnidadTraduccionContext): + pass + + + # Enter a parse tree produced by zaplangParser#declaracionExterna. + def enterDeclaracionExterna(self, ctx:zaplangParser.DeclaracionExternaContext): + pass + + # Exit a parse tree produced by zaplangParser#declaracionExterna. + def exitDeclaracionExterna(self, ctx:zaplangParser.DeclaracionExternaContext): + pass + + + # Enter a parse tree produced by zaplangParser#declaracionFuncion. + def enterDeclaracionFuncion(self, ctx:zaplangParser.DeclaracionFuncionContext): + pass + + # Exit a parse tree produced by zaplangParser#declaracionFuncion. + def exitDeclaracionFuncion(self, ctx:zaplangParser.DeclaracionFuncionContext): + pass + + + # Enter a parse tree produced by zaplangParser#tipoRetorno. + def enterTipoRetorno(self, ctx:zaplangParser.TipoRetornoContext): + pass + + # Exit a parse tree produced by zaplangParser#tipoRetorno. + def exitTipoRetorno(self, ctx:zaplangParser.TipoRetornoContext): + pass + + + # Enter a parse tree produced by zaplangParser#identificadorFuncion. + def enterIdentificadorFuncion(self, ctx:zaplangParser.IdentificadorFuncionContext): + pass + + # Exit a parse tree produced by zaplangParser#identificadorFuncion. + def exitIdentificadorFuncion(self, ctx:zaplangParser.IdentificadorFuncionContext): + pass + + + # Enter a parse tree produced by zaplangParser#listaParametros. + def enterListaParametros(self, ctx:zaplangParser.ListaParametrosContext): + pass + + # Exit a parse tree produced by zaplangParser#listaParametros. + def exitListaParametros(self, ctx:zaplangParser.ListaParametrosContext): + pass + + + # Enter a parse tree produced by zaplangParser#declaracionParametro. + def enterDeclaracionParametro(self, ctx:zaplangParser.DeclaracionParametroContext): + pass + + # Exit a parse tree produced by zaplangParser#declaracionParametro. + def exitDeclaracionParametro(self, ctx:zaplangParser.DeclaracionParametroContext): + pass + + + # Enter a parse tree produced by zaplangParser#especificadorTipo. + def enterEspecificadorTipo(self, ctx:zaplangParser.EspecificadorTipoContext): + pass + + # Exit a parse tree produced by zaplangParser#especificadorTipo. + def exitEspecificadorTipo(self, ctx:zaplangParser.EspecificadorTipoContext): + pass + + + # Enter a parse tree produced by zaplangParser#tipoBasico. + def enterTipoBasico(self, ctx:zaplangParser.TipoBasicoContext): + pass + + # Exit a parse tree produced by zaplangParser#tipoBasico. + def exitTipoBasico(self, ctx:zaplangParser.TipoBasicoContext): + pass + + + # Enter a parse tree produced by zaplangParser#puntero. + def enterPuntero(self, ctx:zaplangParser.PunteroContext): + pass + + # Exit a parse tree produced by zaplangParser#puntero. + def exitPuntero(self, ctx:zaplangParser.PunteroContext): + pass + + + # Enter a parse tree produced by zaplangParser#tipoEstructurado. + def enterTipoEstructurado(self, ctx:zaplangParser.TipoEstructuradoContext): + pass + + # Exit a parse tree produced by zaplangParser#tipoEstructurado. + def exitTipoEstructurado(self, ctx:zaplangParser.TipoEstructuradoContext): + pass + + + # Enter a parse tree produced by zaplangParser#declaracionEstruct. + def enterDeclaracionEstruct(self, ctx:zaplangParser.DeclaracionEstructContext): + pass + + # Exit a parse tree produced by zaplangParser#declaracionEstruct. + def exitDeclaracionEstruct(self, ctx:zaplangParser.DeclaracionEstructContext): + pass + + + # Enter a parse tree produced by zaplangParser#miembroEstruct. + def enterMiembroEstruct(self, ctx:zaplangParser.MiembroEstructContext): + pass + + # Exit a parse tree produced by zaplangParser#miembroEstruct. + def exitMiembroEstruct(self, ctx:zaplangParser.MiembroEstructContext): + pass + + + # Enter a parse tree produced by zaplangParser#declaracionEnum. + def enterDeclaracionEnum(self, ctx:zaplangParser.DeclaracionEnumContext): + pass + + # Exit a parse tree produced by zaplangParser#declaracionEnum. + def exitDeclaracionEnum(self, ctx:zaplangParser.DeclaracionEnumContext): + pass + + + # Enter a parse tree produced by zaplangParser#listaEnumeradores. + def enterListaEnumeradores(self, ctx:zaplangParser.ListaEnumeradoresContext): + pass + + # Exit a parse tree produced by zaplangParser#listaEnumeradores. + def exitListaEnumeradores(self, ctx:zaplangParser.ListaEnumeradoresContext): + pass + + + # Enter a parse tree produced by zaplangParser#enumerador. + def enterEnumerador(self, ctx:zaplangParser.EnumeradorContext): + pass + + # Exit a parse tree produced by zaplangParser#enumerador. + def exitEnumerador(self, ctx:zaplangParser.EnumeradorContext): + pass + + + # Enter a parse tree produced by zaplangParser#declaracionVariable. + def enterDeclaracionVariable(self, ctx:zaplangParser.DeclaracionVariableContext): + pass + + # Exit a parse tree produced by zaplangParser#declaracionVariable. + def exitDeclaracionVariable(self, ctx:zaplangParser.DeclaracionVariableContext): + pass + + + # Enter a parse tree produced by zaplangParser#inicializadorVariable. + def enterInicializadorVariable(self, ctx:zaplangParser.InicializadorVariableContext): + pass + + # Exit a parse tree produced by zaplangParser#inicializadorVariable. + def exitInicializadorVariable(self, ctx:zaplangParser.InicializadorVariableContext): + pass + + + # Enter a parse tree produced by zaplangParser#inicializador. + def enterInicializador(self, ctx:zaplangParser.InicializadorContext): + pass + + # Exit a parse tree produced by zaplangParser#inicializador. + def exitInicializador(self, ctx:zaplangParser.InicializadorContext): + pass + + + # Enter a parse tree produced by zaplangParser#inicializadorArreglo. + def enterInicializadorArreglo(self, ctx:zaplangParser.InicializadorArregloContext): + pass + + # Exit a parse tree produced by zaplangParser#inicializadorArreglo. + def exitInicializadorArreglo(self, ctx:zaplangParser.InicializadorArregloContext): + pass + + + # Enter a parse tree produced by zaplangParser#listaInitializers. + def enterListaInitializers(self, ctx:zaplangParser.ListaInitializersContext): + pass + + # Exit a parse tree produced by zaplangParser#listaInitializers. + def exitListaInitializers(self, ctx:zaplangParser.ListaInitializersContext): + pass + + + # Enter a parse tree produced by zaplangParser#sentencia. + def enterSentencia(self, ctx:zaplangParser.SentenciaContext): + pass + + # Exit a parse tree produced by zaplangParser#sentencia. + def exitSentencia(self, ctx:zaplangParser.SentenciaContext): + pass + + + # Enter a parse tree produced by zaplangParser#sentenciaCompuesta. + def enterSentenciaCompuesta(self, ctx:zaplangParser.SentenciaCompuestaContext): + pass + + # Exit a parse tree produced by zaplangParser#sentenciaCompuesta. + def exitSentenciaCompuesta(self, ctx:zaplangParser.SentenciaCompuestaContext): + pass + + + # Enter a parse tree produced by zaplangParser#sentenciaDeclaracion. + def enterSentenciaDeclaracion(self, ctx:zaplangParser.SentenciaDeclaracionContext): + pass + + # Exit a parse tree produced by zaplangParser#sentenciaDeclaracion. + def exitSentenciaDeclaracion(self, ctx:zaplangParser.SentenciaDeclaracionContext): + pass + + + # Enter a parse tree produced by zaplangParser#sentenciaExpresion. + def enterSentenciaExpresion(self, ctx:zaplangParser.SentenciaExpresionContext): + pass + + # Exit a parse tree produced by zaplangParser#sentenciaExpresion. + def exitSentenciaExpresion(self, ctx:zaplangParser.SentenciaExpresionContext): + pass + + + # Enter a parse tree produced by zaplangParser#sentenciaSeleccion. + def enterSentenciaSeleccion(self, ctx:zaplangParser.SentenciaSeleccionContext): + pass + + # Exit a parse tree produced by zaplangParser#sentenciaSeleccion. + def exitSentenciaSeleccion(self, ctx:zaplangParser.SentenciaSeleccionContext): + pass + + + # Enter a parse tree produced by zaplangParser#casoEtiqueta. + def enterCasoEtiqueta(self, ctx:zaplangParser.CasoEtiquetaContext): + pass + + # Exit a parse tree produced by zaplangParser#casoEtiqueta. + def exitCasoEtiqueta(self, ctx:zaplangParser.CasoEtiquetaContext): + pass + + + # Enter a parse tree produced by zaplangParser#etiquetaPorDef. + def enterEtiquetaPorDef(self, ctx:zaplangParser.EtiquetaPorDefContext): + pass + + # Exit a parse tree produced by zaplangParser#etiquetaPorDef. + def exitEtiquetaPorDef(self, ctx:zaplangParser.EtiquetaPorDefContext): + pass + + + # Enter a parse tree produced by zaplangParser#sentenciaIteracion. + def enterSentenciaIteracion(self, ctx:zaplangParser.SentenciaIteracionContext): + pass + + # Exit a parse tree produced by zaplangParser#sentenciaIteracion. + def exitSentenciaIteracion(self, ctx:zaplangParser.SentenciaIteracionContext): + pass + + + # Enter a parse tree produced by zaplangParser#sentenciaSalto. + def enterSentenciaSalto(self, ctx:zaplangParser.SentenciaSaltoContext): + pass + + # Exit a parse tree produced by zaplangParser#sentenciaSalto. + def exitSentenciaSalto(self, ctx:zaplangParser.SentenciaSaltoContext): + pass + + + # Enter a parse tree produced by zaplangParser#bloque. + def enterBloque(self, ctx:zaplangParser.BloqueContext): + pass + + # Exit a parse tree produced by zaplangParser#bloque. + def exitBloque(self, ctx:zaplangParser.BloqueContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresion. + def enterExpresion(self, ctx:zaplangParser.ExpresionContext): + pass + + # Exit a parse tree produced by zaplangParser#expresion. + def exitExpresion(self, ctx:zaplangParser.ExpresionContext): + pass + + + # Enter a parse tree produced by zaplangParser#asignacionExpresion. + def enterAsignacionExpresion(self, ctx:zaplangParser.AsignacionExpresionContext): + pass + + # Exit a parse tree produced by zaplangParser#asignacionExpresion. + def exitAsignacionExpresion(self, ctx:zaplangParser.AsignacionExpresionContext): + pass + + + # Enter a parse tree produced by zaplangParser#operadorAsignacion. + def enterOperadorAsignacion(self, ctx:zaplangParser.OperadorAsignacionContext): + pass + + # Exit a parse tree produced by zaplangParser#operadorAsignacion. + def exitOperadorAsignacion(self, ctx:zaplangParser.OperadorAsignacionContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionCondicional. + def enterExpresionCondicional(self, ctx:zaplangParser.ExpresionCondicionalContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionCondicional. + def exitExpresionCondicional(self, ctx:zaplangParser.ExpresionCondicionalContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionLogicaO. + def enterExpresionLogicaO(self, ctx:zaplangParser.ExpresionLogicaOContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionLogicaO. + def exitExpresionLogicaO(self, ctx:zaplangParser.ExpresionLogicaOContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionLogicaY. + def enterExpresionLogicaY(self, ctx:zaplangParser.ExpresionLogicaYContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionLogicaY. + def exitExpresionLogicaY(self, ctx:zaplangParser.ExpresionLogicaYContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionIgualacion. + def enterExpresionIgualacion(self, ctx:zaplangParser.ExpresionIgualacionContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionIgualacion. + def exitExpresionIgualacion(self, ctx:zaplangParser.ExpresionIgualacionContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionRelacional. + def enterExpresionRelacional(self, ctx:zaplangParser.ExpresionRelacionalContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionRelacional. + def exitExpresionRelacional(self, ctx:zaplangParser.ExpresionRelacionalContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionDesplazamiento. + def enterExpresionDesplazamiento(self, ctx:zaplangParser.ExpresionDesplazamientoContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionDesplazamiento. + def exitExpresionDesplazamiento(self, ctx:zaplangParser.ExpresionDesplazamientoContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionAditiva. + def enterExpresionAditiva(self, ctx:zaplangParser.ExpresionAditivaContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionAditiva. + def exitExpresionAditiva(self, ctx:zaplangParser.ExpresionAditivaContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionMultiplicativa. + def enterExpresionMultiplicativa(self, ctx:zaplangParser.ExpresionMultiplicativaContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionMultiplicativa. + def exitExpresionMultiplicativa(self, ctx:zaplangParser.ExpresionMultiplicativaContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionUnaria. + def enterExpresionUnaria(self, ctx:zaplangParser.ExpresionUnariaContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionUnaria. + def exitExpresionUnaria(self, ctx:zaplangParser.ExpresionUnariaContext): + pass + + + # Enter a parse tree produced by zaplangParser#operadorUnario. + def enterOperadorUnario(self, ctx:zaplangParser.OperadorUnarioContext): + pass + + # Exit a parse tree produced by zaplangParser#operadorUnario. + def exitOperadorUnario(self, ctx:zaplangParser.OperadorUnarioContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionPostfija. + def enterExpresionPostfija(self, ctx:zaplangParser.ExpresionPostfijaContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionPostfija. + def exitExpresionPostfija(self, ctx:zaplangParser.ExpresionPostfijaContext): + pass + + + # Enter a parse tree produced by zaplangParser#expresionPrimaria. + def enterExpresionPrimaria(self, ctx:zaplangParser.ExpresionPrimariaContext): + pass + + # Exit a parse tree produced by zaplangParser#expresionPrimaria. + def exitExpresionPrimaria(self, ctx:zaplangParser.ExpresionPrimariaContext): + pass + + + # Enter a parse tree produced by zaplangParser#constanteExpresion. + def enterConstanteExpresion(self, ctx:zaplangParser.ConstanteExpresionContext): + pass + + # Exit a parse tree produced by zaplangParser#constanteExpresion. + def exitConstanteExpresion(self, ctx:zaplangParser.ConstanteExpresionContext): + pass + + + # Enter a parse tree produced by zaplangParser#listaArgumentos. + def enterListaArgumentos(self, ctx:zaplangParser.ListaArgumentosContext): + pass + + # Exit a parse tree produced by zaplangParser#listaArgumentos. + def exitListaArgumentos(self, ctx:zaplangParser.ListaArgumentosContext): + pass + + + # Enter a parse tree produced by zaplangParser#marcaPunto. + def enterMarcaPunto(self, ctx:zaplangParser.MarcaPuntoContext): + pass + + # Exit a parse tree produced by zaplangParser#marcaPunto. + def exitMarcaPunto(self, ctx:zaplangParser.MarcaPuntoContext): + pass + + + +del zaplangParser \ No newline at end of file diff --git a/zaplangParserVisitor.py b/zaplangParserVisitor.py new file mode 100644 index 0000000..9393e33 --- /dev/null +++ b/zaplangParserVisitor.py @@ -0,0 +1,258 @@ +# Generated from zaplangParser.g4 by ANTLR 4.13.2 +from antlr4 import * +if "." in __name__: + from .zaplangParser import zaplangParser +else: + from zaplangParser import zaplangParser + +# This class defines a complete generic visitor for a parse tree produced by zaplangParser. + +class zaplangParserVisitor(ParseTreeVisitor): + + # Visit a parse tree produced by zaplangParser#unidadTraduccion. + def visitUnidadTraduccion(self, ctx:zaplangParser.UnidadTraduccionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#declaracionExterna. + def visitDeclaracionExterna(self, ctx:zaplangParser.DeclaracionExternaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#declaracionFuncion. + def visitDeclaracionFuncion(self, ctx:zaplangParser.DeclaracionFuncionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#tipoRetorno. + def visitTipoRetorno(self, ctx:zaplangParser.TipoRetornoContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#identificadorFuncion. + def visitIdentificadorFuncion(self, ctx:zaplangParser.IdentificadorFuncionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#listaParametros. + def visitListaParametros(self, ctx:zaplangParser.ListaParametrosContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#declaracionParametro. + def visitDeclaracionParametro(self, ctx:zaplangParser.DeclaracionParametroContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#especificadorTipo. + def visitEspecificadorTipo(self, ctx:zaplangParser.EspecificadorTipoContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#tipoBasico. + def visitTipoBasico(self, ctx:zaplangParser.TipoBasicoContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#puntero. + def visitPuntero(self, ctx:zaplangParser.PunteroContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#tipoEstructurado. + def visitTipoEstructurado(self, ctx:zaplangParser.TipoEstructuradoContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#declaracionEstruct. + def visitDeclaracionEstruct(self, ctx:zaplangParser.DeclaracionEstructContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#miembroEstruct. + def visitMiembroEstruct(self, ctx:zaplangParser.MiembroEstructContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#declaracionEnum. + def visitDeclaracionEnum(self, ctx:zaplangParser.DeclaracionEnumContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#listaEnumeradores. + def visitListaEnumeradores(self, ctx:zaplangParser.ListaEnumeradoresContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#enumerador. + def visitEnumerador(self, ctx:zaplangParser.EnumeradorContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#declaracionVariable. + def visitDeclaracionVariable(self, ctx:zaplangParser.DeclaracionVariableContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#inicializadorVariable. + def visitInicializadorVariable(self, ctx:zaplangParser.InicializadorVariableContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#inicializador. + def visitInicializador(self, ctx:zaplangParser.InicializadorContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#inicializadorArreglo. + def visitInicializadorArreglo(self, ctx:zaplangParser.InicializadorArregloContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#listaInitializers. + def visitListaInitializers(self, ctx:zaplangParser.ListaInitializersContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#sentencia. + def visitSentencia(self, ctx:zaplangParser.SentenciaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#sentenciaCompuesta. + def visitSentenciaCompuesta(self, ctx:zaplangParser.SentenciaCompuestaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#sentenciaDeclaracion. + def visitSentenciaDeclaracion(self, ctx:zaplangParser.SentenciaDeclaracionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#sentenciaExpresion. + def visitSentenciaExpresion(self, ctx:zaplangParser.SentenciaExpresionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#sentenciaSeleccion. + def visitSentenciaSeleccion(self, ctx:zaplangParser.SentenciaSeleccionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#casoEtiqueta. + def visitCasoEtiqueta(self, ctx:zaplangParser.CasoEtiquetaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#etiquetaPorDef. + def visitEtiquetaPorDef(self, ctx:zaplangParser.EtiquetaPorDefContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#sentenciaIteracion. + def visitSentenciaIteracion(self, ctx:zaplangParser.SentenciaIteracionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#sentenciaSalto. + def visitSentenciaSalto(self, ctx:zaplangParser.SentenciaSaltoContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#bloque. + def visitBloque(self, ctx:zaplangParser.BloqueContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresion. + def visitExpresion(self, ctx:zaplangParser.ExpresionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#asignacionExpresion. + def visitAsignacionExpresion(self, ctx:zaplangParser.AsignacionExpresionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#operadorAsignacion. + def visitOperadorAsignacion(self, ctx:zaplangParser.OperadorAsignacionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionCondicional. + def visitExpresionCondicional(self, ctx:zaplangParser.ExpresionCondicionalContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionLogicaO. + def visitExpresionLogicaO(self, ctx:zaplangParser.ExpresionLogicaOContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionLogicaY. + def visitExpresionLogicaY(self, ctx:zaplangParser.ExpresionLogicaYContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionIgualacion. + def visitExpresionIgualacion(self, ctx:zaplangParser.ExpresionIgualacionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionRelacional. + def visitExpresionRelacional(self, ctx:zaplangParser.ExpresionRelacionalContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionDesplazamiento. + def visitExpresionDesplazamiento(self, ctx:zaplangParser.ExpresionDesplazamientoContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionAditiva. + def visitExpresionAditiva(self, ctx:zaplangParser.ExpresionAditivaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionMultiplicativa. + def visitExpresionMultiplicativa(self, ctx:zaplangParser.ExpresionMultiplicativaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionUnaria. + def visitExpresionUnaria(self, ctx:zaplangParser.ExpresionUnariaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#operadorUnario. + def visitOperadorUnario(self, ctx:zaplangParser.OperadorUnarioContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionPostfija. + def visitExpresionPostfija(self, ctx:zaplangParser.ExpresionPostfijaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#expresionPrimaria. + def visitExpresionPrimaria(self, ctx:zaplangParser.ExpresionPrimariaContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#constanteExpresion. + def visitConstanteExpresion(self, ctx:zaplangParser.ConstanteExpresionContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#listaArgumentos. + def visitListaArgumentos(self, ctx:zaplangParser.ListaArgumentosContext): + return self.visitChildren(ctx) + + + # Visit a parse tree produced by zaplangParser#marcaPunto. + def visitMarcaPunto(self, ctx:zaplangParser.MarcaPuntoContext): + return self.visitChildren(ctx) + + + +del zaplangParser \ No newline at end of file