incluidos todos, que no lo habĂ­a hecho antes
authordanigm <>
Wed, 26 Mar 2008 22:49:01 +0000 (23:49 +0100)
committerdanigm <>
Wed, 26 Mar 2008 22:49:01 +0000 (23:49 +0100)
28 files changed:
Ambito.java [new file with mode: 0755]
AnaSem.g [new file with mode: 0755]
AnaSem.java [new file with mode: 0644]
AnaSem.smap [new file with mode: 0644]
AnaSemTokenTypes.java [new file with mode: 0644]
AnaSemTokenTypes.txt [new file with mode: 0644]
Analex.g [new file with mode: 0755]
Analex.java [new file with mode: 0644]
Analex.smap [new file with mode: 0644]
AnalexTokenTypes.java [new file with mode: 0644]
AnalexTokenTypes.txt [new file with mode: 0644]
Anasint.g [new file with mode: 0755]
Anasint.java [new file with mode: 0644]
Anasint.smap [new file with mode: 0644]
AnasintTokenTypes.java [new file with mode: 0644]
AnasintTokenTypes.txt [new file with mode: 0644]
Atr_Expr.java [new file with mode: 0755]
Pila.java [new file with mode: 0755]
Pila_Ambitos.java [new file with mode: 0755]
Principal.java [new file with mode: 0755]
Simbolo.java [new file with mode: 0755]
Tabla_Simbolos.java [new file with mode: 0755]
logFile.java [new file with mode: 0644]
p.cfg [new file with mode: 0755]
p.res [new file with mode: 0644]
p1.cfg [new file with mode: 0755]
p1.res [new file with mode: 0644]
pruebas.java [new file with mode: 0755]

diff --git a/Ambito.java b/Ambito.java
new file mode 100755 (executable)
index 0000000..4d212c7
--- /dev/null
@@ -0,0 +1,46 @@
+
+public class Ambito {
+       String nombre; //identificador de ambito
+       String tipo; //tipo de ambito
+       Tabla_Simbolos declaraciones_contenidas;
+       Ambito contenedor;
+       
+       public Ambito(String nombre, String tipo, Tabla_Simbolos dec, Ambito contenedor){
+               this.nombre = nombre;
+               this.tipo = tipo;
+               this.declaraciones_contenidas = dec;
+               this.contenedor = contenedor;
+       }
+       public String getNombre(){
+               return nombre;
+       }
+       public String getTipo(){
+               return tipo;
+       }
+       public Ambito getContenedor(){
+               return contenedor;
+       }
+       //busca el nombre en las declaraciones
+       public Simbolo getDeclaracion(String nombre){
+               Simbolo ret = null;
+               if(declaraciones_contenidas != null)
+                       ret = declaraciones_contenidas.getSimbolo(nombre);
+               if(ret != null)
+                       return ret;
+               else return null;
+       }
+       public void setNombre(String nombre){
+               this.nombre = nombre;
+       }
+       public void setTipo(String tipo){
+               this.tipo = tipo;
+       }
+       public void setContenedor(Ambito contenedor){
+               this.contenedor = contenedor;
+       }
+       public void setDeclaracion(Simbolo s){
+               if(declaraciones_contenidas == null)
+                       declaraciones_contenidas = new Tabla_Simbolos();
+               declaraciones_contenidas.setSimbolo(s);
+       }
+}
diff --git a/AnaSem.g b/AnaSem.g
new file mode 100755 (executable)
index 0000000..103429a
--- /dev/null
+++ b/AnaSem.g
@@ -0,0 +1,875 @@
+header{ \r
+       \r
+       import java.util.*; \r
+\r
+}\r
+\r
+class AnaSem extends TreeParser;\r
+options{\r
+       buildAST=true;\r
+       importVocab=Analex;\r
+       importVocab=Anasint;\r
+}\r
+{ \r
+  int cont_dev; // variable contador del numero de instrucciones DEV en un metodo\r
+       \r
+       \r
+       Atr_Expr AS_Literal(AST lit){\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST tipo;\r
+               if(lit == null) return null;\r
+               switch(lit.getType()){\r
+               case LIT_ENTERO: \r
+                       tipo = #(#[ENTERO,"entero"]);\r
+                       break;\r
+               case LIT_REAL:\r
+                       tipo = #(#[REAL,"real"]);\r
+                       break;\r
+               case LIT_CAR: \r
+                       tipo = #(#[CARACTER,"caracter"]);\r
+                       break;\r
+               case CIERTO:\r
+               case FALSO:\r
+                       tipo = #(#[LOGICO,"logico"]);\r
+                       break;\r
+               default:\r
+                       return null;\r
+               }\r
+               result.setTipo(tipo);\r
+               result.setLVal(false);\r
+               result.setRVal(true);\r
+               return result;\r
+       }\r
+       \r
+       Atr_Expr AS_Acceso_Simple(AST dec){\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST tipo = null;\r
+               if (dec == null) return null;\r
+               switch(dec.getType()){\r
+               case MODULO:\r
+                       System.out.println("ERROR CT: el tipo es modulo");\r
+                       return null;\r
+               case CLASE: //acceso a clase no instanciable\r
+                       tipo = dec;\r
+                       result.setLVal(false);\r
+                       result.setRVal(false);\r
+                       break;\r
+               case ATRIBUTO://acceso a un atributo de la propia clase\r
+                       tipo = dec.getFirstChild().getNextSibling();\r
+                       result.setLVal(true);\r
+                       result.setRVal(true);\r
+                       break;\r
+               case METODO: //acceso a un metodo de la propia clase\r
+                       tipo = dec.getFirstChild();\r
+                       result.setLVal(false);\r
+                       result.setRVal(false);\r
+                       break;\r
+               case PARAMETRO:\r
+                       tipo = dec.getFirstChild().getNextSibling();\r
+                       result.setLVal(false);\r
+                       result.setRVal(true);\r
+                       break;\r
+               case VARIABLE_LOCAL:\r
+                       tipo = dec.getFirstChild().getNextSibling();\r
+                       result.setLVal(true);\r
+                       result.setRVal(true);\r
+                       break;\r
+               case ERROR:\r
+                       return null;\r
+               }\r
+               result.setTipo(tipo);\r
+               return result;\r
+       }\r
+       \r
+       Atr_Expr AS_Acceso_Objeto(Atr_Expr atr_raiz, AST raiz, AST atrib){\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST tipo, tipo_raiz, aux;\r
+               if(atr_raiz == null || raiz == null || atrib ==null) return null;\r
+               //comprobar que el tipo de la raiz sea clase\r
+               tipo_raiz = atr_raiz.getTipo();\r
+               if(tipo_raiz.getType() != CLASE){\r
+                       System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" no es una clase");\r
+                       return null;\r
+               }\r
+               //si la raiz es una clase instanciable\r
+               if(raiz.getFirstChild().getNextSibling().getType() == CLASE){\r
+                       if(tipo_raiz.getFirstChild().getNextSibling().getType() != NO_INST){\r
+                               System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" es una clase instanciable");\r
+                               return null;\r
+                       }\r
+               }\r
+               //si la raiz es un objeto\r
+               else{\r
+                       if(tipo_raiz.getFirstChild().getNextSibling().getType() != INST){\r
+                               System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" es un objeto de clase no instanciable");\r
+                               return null;\r
+                       }\r
+               }\r
+               //comprobar que "atrib" sea un atributo o metodo de la clase y ademas sea visible\r
+               aux = tipo_raiz.getFirstChild().getNextSibling().getNextSibling();\r
+               while(aux!= null){\r
+                       if(aux.getType() == METODO){\r
+                               if(aux.getFirstChild().getFirstChild().equals(atrib))\r
+                                       break;\r
+                       }else{ //atributo\r
+                               if(aux.getFirstChild().equals(atrib))\r
+                                       break;\r
+                       }\r
+                       aux = aux.getNextSibling();\r
+               }\r
+               if(aux == null){\r
+                       System.out.println("ERROR CT: el atributo "+atrib.getText()+" no pertenece a la clase "+raiz.getFirstChild().getText());\r
+                       return null;\r
+               }\r
+               if(aux.getFirstChild().getNextSibling().getNextSibling().getType() != VISIBLE){\r
+                       System.out.println("ERROR CT: el atributo "+atrib.getText()+" no es visible");\r
+                       return null;\r
+               }\r
+               \r
+               //tipo de la expresion\r
+               if(aux.getType() == METODO){\r
+                       tipo = aux.getFirstChild();\r
+                       result.setLVal(false);\r
+                       result.setRVal(false);\r
+               }else{ //atributo\r
+                       tipo = aux.getFirstChild().getNextSibling();\r
+                       result.setLVal(true);\r
+                       result.setRVal(true);\r
+               }\r
+               result.setTipo(tipo);\r
+               return result;\r
+       \r
+       }\r
+       \r
+       //hay que pasarle la raiz para saber el nombre de la raiz cuando no es un metodo\r
+       Atr_Expr AS_Llamada(Atr_Expr atr_raiz, LinkedList expresiones){\r
+               ListIterator it = expresiones.listIterator();\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST pars, par_f, tipo;\r
+               Atr_Expr par_r;\r
+               \r
+               //comprobar que atr_raiz no se a null\r
+               if(atr_raiz == null || expresiones == null){\r
+                       return null;\r
+               }\r
+               //comprobar que la raiz sea de tipo prototipo\r
+               if(atr_raiz.getTipo().getType() != PROTOTIPO){\r
+                       System.out.println("ERROR CT: "+atr_raiz.getTipo().getText()+" no es un metodo.");\r
+                       return null;\r
+               }\r
+               //comprobar que los parametros reales coinciden con los formales\r
+               pars = atr_raiz.getTipo().getFirstChild().getNextSibling();\r
+               par_f = pars.getFirstChild();\r
+               while (it.hasNext() && (par_f != null)){\r
+                       par_r = (Atr_Expr)it.next();\r
+                       if(! par_f.getFirstChild().getNextSibling().equalsTree(par_r.getTipo())){\r
+                               System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
+                               return null;\r
+                       }\r
+                       par_f = par_f.getNextSibling();\r
+               }\r
+               if(it.hasNext() && (par_f == null)){\r
+                       System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
+                       return null;\r
+               }\r
+               if(!it.hasNext() && (par_f != null)){\r
+                       System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
+                       return null;\r
+               }\r
+               //el tipo de la expresion es el rango del metodo\r
+               tipo = atr_raiz.getTipo().getFirstChild().getNextSibling().getNextSibling().getFirstChild();\r
+               result.setLVal(false);\r
+               result.setRVal(true);\r
+               result.setTipo(tipo);\r
+               return result;\r
+       }\r
+       \r
+       Atr_Expr AS_Acceso_Tabla(Atr_Expr atr_raiz, LinkedList expresiones){\r
+               if(atr_raiz == null || expresiones == null) return null;\r
+               ListIterator it = expresiones.listIterator();\r
+               Atr_Expr result = new Atr_Expr();\r
+               Atr_Expr aux;\r
+               AST tipo;\r
+               int tam = 0;\r
+               //comprobar que el tipo de la raizes una formacion\r
+               //TODO\r
+               if(atr_raiz.getTipo().getType() != FORMACION){\r
+                       System.out.println("ERROR CT: intentando acceder a \""+atr_raiz.getTipo().getText()+"\" como formacion");\r
+                       return null;\r
+               }\r
+               //comprobar que el numero de expresiones coincida con el numero  de dimensiones\r
+               while(it.hasNext()){\r
+                       tam++;\r
+                       aux = (Atr_Expr) it.next();\r
+                       if(aux == null) return null;\r
+                       if(aux.getTipo().getType() != ENTERO){\r
+                               System.out.println("ERROR CT: no coinciden el numero de expresiones en el acceso a formacion");\r
+                               return null;\r
+                       }\r
+               }\r
+               if(tam != atr_raiz.getTipo().getFirstChild().getNumberOfChildren()){\r
+                       System.out.println("ERROR CT: no coinciden el numero de expresiones en el acceso a formacion");\r
+                       return null;\r
+               }\r
+               tipo = atr_raiz.getTipo().getFirstChild().getNextSibling();\r
+               result.setTipo(tipo);\r
+               result.setLVal(atr_raiz.getLVal());\r
+               result.setRVal(atr_raiz.getRVal());\r
+               return result;\r
+       }\r
+       \r
+       \r
+       \r
+       //AS DE EXPRESIONES\r
+  \r
+  //Expresiones binarias aritmeticas\r
+  Atr_Expr AS_Exp_Bin_Arit(Atr_Expr e1, Atr_Expr e2){\r
+       Atr_Expr result = new Atr_Expr();\r
+       String men="";\r
+       if(e1 == null || e2 == null) return null;\r
+       \r
+       //Comprobamos que e1 y e2 sean consultables\r
+       if(!e1.getLVal() || !e2.getRVal()){\r
+               if (!e2.getRVal()) men="ERROR LR: la expresion no puede aparecer a la derecha de una expresion binaria" ;\r
+               if (!e1.getLVal()) men="ERROR LR: la expresion no puede aparecer a la izquierda de una expresion binaria" ;\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //Comprobamos que e1 y e2 sean numericas y compatibles\r
+       if((e1.getTipo().getType()!=ENTERO) && (e1.getTipo().getType()!=REAL) ||\r
+       (e2.getTipo().getType()!=ENTERO) && (e2.getTipo().getType()!=REAL)){\r
+               System.out.println("ERROR CT: no son expresiones numericas ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
+               return null;\r
+       }\r
+       if(!e1.getTipo().equals(e2.getTipo())){\r
+               System.out.println("ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
+               return null;\r
+       }\r
+       \r
+       //Calculamos el tipo\r
+       result.setTipo(e1.getTipo());\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  \r
+  //Expresiones binarias logicas\r
+  Atr_Expr AS_Exp_Bin_Log(Atr_Expr e1, Atr_Expr e2){\r
+       Atr_Expr result = new Atr_Expr();\r
+       String men = "";\r
+       \r
+       if(e1 == null || e2 == null) return null;\r
+       //Comprobar que las expresiones son consultables\r
+       if(!e1.getLVal() || !e2.getRVal()){\r
+               if (!e2.getRVal()) men ="ERROR LR: la expresion no puede aparecer a la derecha de la expresion" ;\r
+               if (!e1.getLVal()) men ="ERROR LR: la expresion "+e1.getTipo().getFirstChild().getText()+" no puede aparecer a la izquierda de la expresion" ;\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //Comprobamos que sean de tipo logico\r
+       if((e1.getTipo().getType()!=LOGICO) || (e2.getTipo().getType()!=LOGICO)){\r
+               if (e1.getTipo().getType()!=LOGICO)\r
+                       men = "ERROR CT: la expresion "+e1.getTipo().getFirstChild().getText()+"no es de tipo logico";\r
+               if (e2.getTipo().getType()!=LOGICO)\r
+                       men = "ERROR CT: la expresion "+e2.getTipo().getFirstChild().getText()+"no es de tipo logico";\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //Calculamos el tipo\r
+       result.setTipo(e1.getTipo());\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  //Expresiones binarias relacionales\r
+  Atr_Expr AS_Exp_Bin_Rel(Atr_Expr e1, Atr_Expr e2, AST operador){\r
+       Atr_Expr result = new Atr_Expr();\r
+       AST tipo;\r
+       String men = "";\r
+       \r
+       if(e1 == null || e2 == null || operador == null) return null;\r
+       //Comprobamos que las expresiones son consultables\r
+       if(!e1.getLVal() || !e2.getRVal()){\r
+               if (!e2.getRVal()) men ="ERROR LR: la expresion no se puede consultar en la expresion binaria" ;\r
+               if (!e1.getLVal()) men ="ERROR LR: la expresion "+e1.getTipo().getFirstChild().getText()+" no puede aparecer a la izquierda en la expresion";\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //No dejamos que se utilicen formaciones y comprobamos la compatibilidad de las expresiones\r
+       if(e1.getTipo().getType()==FORMACION){\r
+               System.out.println("ERROR CT: no puede tener formaciones en expresiones relacionales");\r
+               return null;\r
+       }\r
+       men = "ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")";\r
+       if(!e1.getTipo().equals(e2.getTipo())){\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+\r
+       if((e1.getTipo().getType() == CLASE) && (!e1.getTipo().getFirstChild().equals(e2.getTipo().getFirstChild()))){ //Comparamos las clases por nombre\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //Miramos los grupos de operadores\r
+       if((operador.getType()!=IGUAL && operador.getType()!=DISTINTO) && (e1.getTipo().getType()==CLASE || e1.getTipo().getType()==LOGICO)){\r
+               System.out.println("ERROR CT: el operador \""+operador.getText()+"\" no esta permitido para los tipos usados ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
+               return null;\r
+       }\r
+       \r
+       //Establecemos el tipo\r
+       tipo = #(#[LOGICO,"logico"]);\r
+       result.setTipo(tipo);\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  //Expresiones unarias aritmeticas == MENOS UNARIO\r
+  Atr_Expr AS_Exp_Una_Arit(Atr_Expr e){\r
+       Atr_Expr result = new Atr_Expr();\r
+       String men="";\r
+       \r
+       if(e == null) return null;\r
+       //e tiene que ser consultable\r
+       if(!e.getRVal()){\r
+               men ="ERROR LR: la expresion no es consultable" ;\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //comprobar que e es de tipo numerico\r
+       if( e.getTipo().getType()!=ENTERO && e.getTipo().getType()!=REAL){\r
+               System.out.println("ERROR CT: el menos unario solo puede ser utilizado en expresiones numericas");\r
+               return null;\r
+       }\r
+       \r
+       //Establecemos el tipo\r
+       result.setTipo(e.getTipo());\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  //Expresiones unarias logicas == NEGACION\r
+  //Identica a la anterior\r
+  Atr_Expr AS_Exp_Una_Log(Atr_Expr e){\r
+       Atr_Expr result = new Atr_Expr();\r
+       \r
+       if(e == null) return null;\r
+       //e tiene que ser consultable\r
+       if(!e.getRVal()){\r
+               System.out.println("ERROR LR: la expresion no es consultable" );\r
+               return null;\r
+       }\r
+       \r
+       //comprobar que e es de tipo numerico\r
+       if( e.getTipo().getType()!=LOGICO){\r
+               System.out.println("ERROR CT: la negacion solo se puede utilizar con expresiones logicas");\r
+               return null;\r
+       }\r
+       \r
+       //Establecemos el tipo\r
+       result.setTipo(e.getTipo());\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  //Instrucciones\r
+  //Asignacion\r
+  void AS_Asignacion(Atr_Expr e1, Atr_Expr e2, AST e3, AST e4){\r
+       //comprobar si alguno es null\r
+       String men = "";\r
+       if(e1==null || e2 == null) return;\r
+               \r
+       //Comprobamos la consultabilidad de las expresiones\r
+       if(!e1.getLVal() || !e2.getRVal()){\r
+               if (!e2.getRVal())\r
+                       men ="ERROR LR: la expresion "+e4.getFirstChild().getText()+" no puede aparecer a la derecha de una asignacion." ;\r
+               if (!e1.getLVal()) men ="ERROR LR: el "+e3.getFirstChild().getNextSibling().getText()+" "+e3.getFirstChild().getText()+" no puede aparecer a la izquierda de una asignacion." ;\r
+               System.out.println(men);\r
+               return;\r
+       }\r
+       \r
+       //No dejamos asignar formaciones y comprobamos la compatibilidad de tipos\r
+       if(e1.getTipo().getType()==FORMACION){\r
+               System.out.println("ERROR CT: no dejamos asignar formaciones");\r
+       }\r
+       men = "ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")";\r
+       if(!e1.getTipo().equals(e2.getTipo())){\r
+               System.out.println(men);\r
+       }\r
+       if((e1.getTipo().getType() == CLASE) && (!e1.getTipo().getFirstChild().equals(e2.getTipo().getFirstChild()))){ //Comparamos las clases por nombre\r
+               System.out.println(men);\r
+       }\r
+  }\r
+  \r
+  //Condiciones\r
+  void AS_Condicional(Atr_Expr e){\r
+       String men = "";\r
+       if (e == null) return;\r
+       if(!e.getRVal()){\r
+               men ="ERROR LR: la expresion no es consultable" ;\r
+               System.out.println(men);\r
+               return;\r
+       }\r
+       \r
+       //Comprobamos que es de tipo logico\r
+       if(e.getTipo().getType()!=LOGICO){\r
+               System.out.println("ERROR CT: no es un tipo logico");\r
+       }\r
+  }\r
+  \r
+  //Instruccion de devolucion\r
+  int AS_Devolucion(AST tipo_dev, Atr_Expr e, int cont){\r
+       String men = "";\r
+//  String men = "ERROR CT: Los tipos no son compatibles (entero y real)"\r
+       if(tipo_dev == null || e == null) return cont+1;\r
+       //Comprobamos que el metodo sea funcional\r
+\r
+       if(cont == -1){\r
+               System.out.println("ERROR CT: el metodo no es funcional");\r
+               return -1;\r
+       }\r
+\r
+       //Comprobar que la expresion e es consultable\r
+       if(!e.getRVal()){\r
+               System.out.println("ERROR CT: la expresion no es consultable, no se puede devolver");\r
+       }\r
+       \r
+       men = "ERROR CT: Los tipos no son compatibles ("+e.getTipo().getText()+" y "+tipo_dev.getText()+")";\r
+       //Comprobamos que el tipo de la expresion es compatible con el tipo que se devuelve\r
+       if(!e.getTipo().equals(tipo_dev)){\r
+               System.out.println(men);\r
+       }\r
+       if(tipo_dev.getType()==CLASE && (!tipo_dev.getFirstChild().equals(e.getTipo().getFirstChild()))){\r
+               System.out.println(men);\r
+       }\r
+       \r
+       if(tipo_dev.getType()==FORMACION && (!tipo_dev.equals(e.getTipo()))){\r
+               System.out.println(men);\r
+       }\r
+       \r
+       return cont + 1;\r
+  }\r
+  \r
+  \r
+  Atr_Expr AS_Crear(Atr_Expr as, AST clase){\r
+               if (as == null || clase == null){\r
+                       System.out.println("ERROR CT: no se puede crear");\r
+                        return null;\r
+               }\r
+               //comprobar que el tipo de la variable es el mismo que el del interior de crear\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST tipo = as.getTipo();\r
+               if(tipo.getType() != CLASE){\r
+                       System.out.println("ERROR CT: no es una clase");\r
+                       return null;\r
+               }\r
+               if(!(tipo.getFirstChild().getNextSibling().getType() == INST)){\r
+                       System.out.println("ERROR CT: la clase no es instanciable");\r
+                       return null;\r
+               }\r
+               AST tipo_var = tipo.getFirstChild();\r
+               AST interior = clase;\r
+               if(!tipo_var.getText().equals(interior.getText())){\r
+                       if(interior.getType() == ACCESO_SIMPLE)\r
+                               System.out.println("ERROR CT: Los tipos no son compatibles ("+tipo_var.getText()+" y "+interior.getFirstChild().getText()+")");\r
+                       else\r
+                               System.out.println("ERROR CT: Los tipos no son compatibles ("+tipo_var.getText()+" y "+interior.getText()+")");\r
+                       return null;\r
+               }\r
+               //hay que comprobar que la clase es instanciable, y que el tipo es clase\r
+\r
+               result.setLVal(false);\r
+               result.setRVal(false);\r
+               //el tipo es el de la variable\r
+               result.setTipo(tipo);\r
+               \r
+               return result;\r
+       }       \r
+       \r
+       //AS Escribir\r
+       void AS_Escribir(Atr_Expr e, AST exp){\r
+               if (e == null){\r
+                       if(exp.getType() == ACCESO_SIMPLE)\r
+                               System.out.println("ERROR CT: no se puede escribir "+ exp.getFirstChild().getText());\r
+                       else\r
+                               System.out.println("ERROR CT: no se puede escribir "+ exp.getText());\r
+                       return;\r
+               }\r
+               //Comprobamos que la expresion se pueda consultar\r
+               if(!e.getRVal()){\r
+                       System.out.println("ERROR CT: la expresion no es consultable, no se puede escribir");\r
+               }\r
+       }\r
+\r
+  \r
+  //AS Entero A Real\r
+  Atr_Expr AS_Entero_A_Real(Atr_Expr e1){\r
+       Atr_Expr result = new Atr_Expr();\r
+       if (e1 == null) return null;\r
+       AST tipo = e1.getTipo();\r
+       if(tipo.getType() != ENTERO){\r
+               System.out.println("ERROR CT: El tipo del parametro del operador enteroareal es incorrecto.");\r
+               return null;\r
+         }\r
+       result.setTipo(#(#[REAL,"real"]));\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       return result;\r
+  }\r
+  Atr_Expr AS_Real_A_Entero(Atr_Expr e1){\r
+       Atr_Expr result = new Atr_Expr();\r
+       \r
+       if (e1 == null) return null;\r
+       AST tipo = e1.getTipo();\r
+       if(tipo.getType() != REAL){\r
+               System.out.println("ERROR CT: El tipo del parametro del operador realaentero es incorrecto.");\r
+               return null;\r
+       }\r
+       result.setTipo(#(#[ENTERO,"entero"]));\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       return result;\r
+  }\r
+  \r
+  \r
+}\r
+\r
+// ========= FIN DE DECLARACION DE FUNCIONES\r
+\r
+declaracion_modulo: #(MODULO nombre_modulo definicion_modulo);\r
+\r
+nombre_modulo : IDENT ;\r
+\r
+definicion_modulo: lista_declaraciones_clases\r
+;\r
+\r
+lista_declaraciones_clases: (declaracion_clase)*\r
+;\r
+\r
+declaracion_clase : #(CLASE nombre_clase cualificador_clase definicion_clase)\r
+;\r
+\r
+cualificador_clase : INST | NO_INST ;\r
+\r
+nombre_clase : IDENT ;\r
+\r
+definicion_clase : declaraciones_elementos_clase\r
+;\r
+\r
+declaraciones_elementos_clase : (declaracion_elemento_clase)* ;\r
+\r
+declaracion_elemento_clase :\r
+#(METODO declaracion_metodo cualificador_elemento_clase)\r
+| #(ATRIBUTO IDENT tipo cualificador_elemento_clase)\r
+;\r
+\r
+cualificador_elemento_clase: OCULTO | VISIBLE ;\r
+\r
+declaracion_metodo {AST tipodev;} : tipodev =prototipo_metodo definicion_metodo[tipodev]\r
+{ if (cont_dev == 0){\r
+       System.out.println("ERROR: Metodo funcional que no devuelve nada");\r
+       System.exit(-1);\r
+  }\r
+} ;\r
+\r
+prototipo_metodo returns [AST tipodev=null]: #(PROTOTIPO IDENT #(PARAMETROS\r
+declaracion_parametros)\r
+#(RESULTADO\r
+( t: tipo {cont_dev = 0; // inicializa el contador de instrucciones DEV\r
+tipodev = t; }\r
+| v: VACIO {cont_dev = -1; // marca a -1 para indicar que es un procedimiento\r
+tipodev = v; }\r
+)))\r
+;\r
+\r
+declaracion_parametros : (declaracion_parametro)* ;\r
+\r
+declaracion_parametro : #(PARAMETRO IDENT tipo) ;\r
+\r
+definicion_metodo [AST tipodev]: #(DEFINICION #(VARIABLES_LOCALES declaracion_variables_locales) #(INSTRUCCIONES instrucciones[tipodev]))\r
+;\r
+\r
+declaracion_variables_locales : (declaracion_variable_local)* ;\r
+\r
+declaracion_variable_local : #(VARIABLE_LOCAL IDENT tipo) ;\r
+\r
+declaracion_error : ERROR;\r
+\r
+instrucciones [AST tipodev] : (instruccion[tipodev])* ;\r
+\r
+instruccion [AST tipodev] : #(INSTRUCCION ( instruccion_simple[tipodev] | instruccion_compuesta[tipodev]))\r
+;\r
+\r
+instruccion_simple [AST tipodev] : crear\r
+| llamada_metodo\r
+| escribir\r
+| asignacion\r
+| retorno [tipodev]\r
+;\r
+\r
+crear{Atr_Expr e1;} : #(CREAR e1=expresion e2:expresion)\r
+{AS_Crear(e1,#e2);}\r
+;\r
+\r
+escribir{Atr_Expr e1;}: #(ESCRIBIR e1=e:expresion)\r
+{AS_Escribir(e1, #e);};\r
+\r
+instruccion_compuesta [AST tipodev] :\r
+condicion [tipodev]\r
+| iteracion [tipodev]\r
+;\r
+\r
+asignacion {Atr_Expr e1, e2;}: #(ASIGNACION e1=e3:expresion e2=e4:expresion )\r
+{      AS_Asignacion(e1,e2,#e3,#e4);\r
+};\r
+\r
+retorno [AST tipodev] {Atr_Expr e;}: #(DEV e=expresion)\r
+{/*AS_Devolucion(tipodev, e);\r
+cont_dev++;*/\r
+cont_dev=AS_Devolucion(tipodev,e,cont_dev);\r
+}\r
+;\r
+\r
+llamada_metodo {Atr_Expr a, res; LinkedList l;}:\r
+#(LLAMADA a=acceso #(EXPRESIONES l=lista_expresiones))\r
+{res=AS_Llamada(a,l);\r
+ if (res != null && res.getTipo().getType() != VACIO){\r
+       System.out.println("ERROR: Llamada a funcion sin asignar valor devuelto.");\r
+       System.exit(1); \r
+ } \r
+} \r
+;\r
+\r
+lista_expresiones returns [LinkedList l= new LinkedList()] {Atr_Expr e;}:\r
+(e=expresion {l.add(e);})* ;\r
+\r
+condicion [AST tipodev] {Atr_Expr e;} : #(SI e=expresion #(INSTRUCCIONES instrucciones[tipodev])\r
+(#(INSTRUCCIONES instrucciones[tipodev]))?)\r
+{AS_Condicional(e);\r
+}\r
+;\r
+\r
+iteracion [AST tipodev] {Atr_Expr e;} : #(MIENTRAS e=expresion #(INSTRUCCIONES\r
+instrucciones[tipodev])) {AS_Condicional(e);\r
+}\r
+;\r
+\r
+expresion returns [Atr_Expr res=null] {Atr_Expr e1,e2; LinkedList l;}:\r
+#(O e1=expresion e2=expresion) {res=AS_Exp_Bin_Log( e1, e2);\r
+}\r
+| #(Y e1=expresion e2=expresion) {res=AS_Exp_Bin_Log( e1, e2);\r
+}\r
+| #(NO e1=expresion) {res=AS_Exp_Una_Log( e1);\r
+}\r
+| #(op1:MAYOR e1=expresion e2=expresion) {res=AS_Exp_Bin_Rel( e1, e2, op1);\r
+}\r
+| #(op2:MAYOR_IGUAL e1=expresion e2=expresion) {res=AS_Exp_Bin_Rel( e1, e2, op2);\r
+}\r
+| #(op3:MENOR e1=expresion e2=expresion) {res=AS_Exp_Bin_Rel( e1, e2, op3);\r
+}\r
+| #(op4:MENOR_IGUAL e1=expresion e2=expresion) {res=AS_Exp_Bin_Rel( e1, e2, op4);\r
+}\r
+| #(op5:IGUAL e1=expresion e2=expresion) {res=AS_Exp_Bin_Rel( e1, e2, op5);\r
+}\r
+| #(op6:DISTINTO e1=expresion e2=expresion) {res=AS_Exp_Bin_Rel( e1, e2, op6);\r
+}\r
+| #(MAS e1=expresion e2=expresion) {res=AS_Exp_Bin_Arit( e1, e2);\r
+}\r
+| #(MENOS e1=expresion e2=expresion) {res=AS_Exp_Bin_Arit( e1, e2);\r
+}\r
+| #(MENOSUNARIO e1=expresion) {res=AS_Exp_Una_Arit( e1);\r
+}\r
+| #(POR e1=expresion e2=expresion) {res=AS_Exp_Bin_Arit( e1, e2);\r
+}\r
+| #(DIVISION e1=expresion e2=expresion) {res=AS_Exp_Bin_Arit( e1, e2);\r
+}\r
+| #(LLAMADA e1=acceso #(EXPRESIONES l=lista_expresiones))\r
+{res=AS_Llamada( e1, l);\r
+if (res != null){\r
+       if (res.getTipo().getType() == VACIO){\r
+               System.out.println("ERROR: No se puede recoger el valor devuelto por un procedimiento (no devuelve nada).");\r
+               System.exit(1);\r
+       }\r
+}\r
+}\r
+| #(ACCESO_TABLA e1=acceso #(EXPRESIONES l=lista_expresiones_nv))\r
+{res=AS_Acceso_Tabla( e1, l);\r
+}\r
+| e1=acceso {res=e1;}\r
+\r
+| i:LIT_ENTERO {res=AS_Literal( i);}\r
+| j:LIT_REAL {res=AS_Literal( j);}\r
+| k:LIT_CAR {res=AS_Literal( k);}\r
+| m:CIERTO {res=AS_Literal( m);}\r
+| n:FALSO {res=AS_Literal( n);}\r
+| #(ENTERO_A_REAL e1=expresion) {res = AS_Entero_A_Real(e1);}\r
+| #(REAL_A_ENTERO e1=expresion) {res = AS_Real_A_Entero(e1);}\r
+| ERROR\r
+;\r
+\r
+acceso returns [Atr_Expr res=null] {Atr_Expr e;}:\r
+e=acceso_simple {res=e;}\r
+| #(ACCESO_OBJETO e=r:acceso_simple a:IDENT) {\r
+       res=AS_Acceso_Objeto( e, r, a);\r
+}\r
+;\r
+\r
+acceso_simple returns [Atr_Expr res=null]:\r
+#(ACCESO_SIMPLE IDENT d:declaracion_acceso) {res=AS_Acceso_Simple(#d);}\r
+;\r
+\r
+declaracion_acceso: declaracion_modulo\r
+| declaracion_clase1\r
+| declaracion_elemento_clase1\r
+| declaracion_parametro1\r
+| declaracion_variable_local1\r
+| declaracion_error\r
+;\r
+\r
+lista_expresiones_nv returns [LinkedList l= new LinkedList()] {Atr_Expr e;}:\r
+(e=expresion {l.add(e);})+ ;\r
+\r
+tipo :\r
+tipo_predefinido_simple\r
+| tipo_predefinido_compuesto\r
+| declaracion_clase1\r
+| declaracion_error\r
+;\r
+\r
+tipo_predefinido_simple :\r
+ENTERO\r
+| REAL\r
+| LOGICO\r
+| CARACTER\r
+;\r
+\r
+tipo_predefinido_compuesto : formacion\r
+;\r
+\r
+formacion {AST t=null;}: #(FORMACION #(LISTA_ENTEROS lista_enteros)(tipo_predefinido_simple | declaracion_clase1))\r
+;\r
+\r
+lista_enteros : (LIT_ENTERO)+ ;\r
+\r
+declaracion_clase1 : #(CLASE n:nombre_clase1 cualificador_clase1 definicion_clase1)\r
+;\r
+cualificador_clase1 : INST | NO_INST;\r
+nombre_clase1 : IDENT \r
+;\r
+definicion_clase1 : declaraciones_elementos_clase1\r
+;\r
+declaraciones_elementos_clase1 : (declaracion_elemento_clase1)* ;\r
+declaracion_elemento_clase1 :\r
+#(METODO declaracion_metodo1 cualificador_elemento_clase1)\r
+| #(ATRIBUTO IDENT tipo1 cualificador_elemento_clase1)\r
+;\r
+cualificador_elemento_clase1: OCULTO | VISIBLE ;\r
+declaracion_metodo1 : prototipo_metodo1 definicion_metodo1 ;\r
+prototipo_metodo1 : #(PROTOTIPO IDENT #(PARAMETROS declaracion_parametros1)\r
+#(RESULTADO (tipo1 | VACIO)))\r
+;\r
+declaracion_parametros1 : (declaracion_parametro1)* ;\r
+declaracion_parametro1 : #(PARAMETRO IDENT tipo1) ;\r
+definicion_metodo1 : #(DEFINICION #(VARIABLES_LOCALES declaracion_variables_locales1)\r
+#(INSTRUCCIONES instrucciones1))\r
+;\r
+declaracion_variables_locales1 : (declaracion_variable_local1)* ;\r
+declaracion_variable_local1 : #(VARIABLE_LOCAL IDENT tipo1);\r
+declaracion_error1 : ERROR;\r
+instrucciones1 : (instruccion1)* ;\r
+instruccion1 : #(INSTRUCCION (instruccion_simple1 | instruccion_compuesta1))\r
+;\r
+instruccion_simple1 : crear1\r
+| llamada_metodo1\r
+| escribir1\r
+| asignacion1\r
+| retorno1\r
+;\r
+\r
+crear1: #(CREAR expresion1 expresion1);\r
+escribir1: #(ESCRIBIR expresion1);\r
+\r
+instruccion_compuesta1 :\r
+condicion1\r
+| iteracion1\r
+;\r
+asignacion1 : #(ASIGNACION expresion1 expresion1 ) ;\r
+retorno1 : #(DEV expresion1) ;\r
+llamada_metodo1 : #(LLAMADA acceso1 #(EXPRESIONES lista_expresiones1)) ;\r
+lista_expresiones1 : (expresion1)* ;\r
+condicion1 : #(SI expresion1 #(INSTRUCCIONES instrucciones1) (#(INSTRUCCIONES\r
+instrucciones1))?)\r
+;\r
+iteracion1 : #(MIENTRAS expresion1 #(INSTRUCCIONES instrucciones1))\r
+;\r
+expresion1: #(O expresion1 expresion1)\r
+| #(Y expresion1 expresion1)\r
+| #(NO expresion1)\r
+| #(MAYOR expresion1 expresion1)\r
+| #(MAYOR_IGUAL expresion1 expresion1)\r
+| #(MENOR expresion1 expresion1)\r
+| #(MENOR_IGUAL expresion1 expresion1)\r
+| #(IGUAL expresion1 expresion1)\r
+| #(DISTINTO expresion1 expresion1)\r
+| #(MAS expresion1 expresion1)\r
+| #(MENOS expresion1 expresion1)\r
+| #(MENOSUNARIO expresion1)\r
+| #(POR expresion1 expresion1)\r
+| #(DIVISION expresion1 expresion1)\r
+| #(LLAMADA acceso1 #(EXPRESIONES lista_expresiones1))\r
+| #(ACCESO_TABLA acceso1 #(EXPRESIONES lista_expresiones_nv1))\r
+| acceso1\r
+| LIT_ENTERO\r
+| LIT_REAL\r
+| LIT_CAR\r
+| CIERTO\r
+| FALSO\r
+| NULO\r
+| #(ENTERO_A_REAL expresion1)\r
+| #(REAL_A_ENTERO expresion1)\r
+| ERROR\r
+;\r
+acceso1: #(ACCESO_SIMPLE IDENT declaracion_acceso1)\r
+| #(ACCESO_OBJETO #(ACCESO_SIMPLE IDENT declaracion_acceso1) IDENT)\r
+;\r
+declaracion_acceso1:\r
+|declaracion_clase1\r
+|declaracion_elemento_clase1\r
+|declaracion_parametro1\r
+|declaracion_variable_local1\r
+|declaracion_error1\r
+;\r
+lista_expresiones_nv1 : (expresion1)+ ;\r
+tipo1 :\r
+tipo_predefinido_simple1\r
+| tipo_predefinido_compuesto1\r
+| declaracion_clase1\r
+| declaracion_error1\r
+;\r
+tipo_predefinido_simple1 :\r
+ENTERO\r
+| REAL\r
+| LOGICO\r
+| CARACTER\r
+;\r
+tipo_predefinido_compuesto1 : formacion1\r
+;\r
+formacion1 : #(FORMACION #(LISTA_ENTEROS lista_enteros1)\r
+(tipo_predefinido_simple1 | declaracion_clase1));\r
+lista_enteros1 : (LIT_ENTERO)+ \r
+;\r
diff --git a/AnaSem.java b/AnaSem.java
new file mode 100644 (file)
index 0000000..baf0801
--- /dev/null
@@ -0,0 +1,5510 @@
+// $ANTLR : "AnaSem.g" -> "AnaSem.java"$
\r
+       \r
+       import java.util.*; \r
+\r
+
+import antlr.TreeParser;
+import antlr.Token;
+import antlr.collections.AST;
+import antlr.RecognitionException;
+import antlr.ANTLRException;
+import antlr.NoViableAltException;
+import antlr.MismatchedTokenException;
+import antlr.SemanticException;
+import antlr.collections.impl.BitSet;
+import antlr.ASTPair;
+import antlr.collections.impl.ASTArray;
+
+
+public class AnaSem extends antlr.TreeParser       implements AnaSemTokenTypes
+ {
\r
+  int cont_dev; // variable contador del numero de instrucciones DEV en un metodo\r
+       \r
+       \r
+       Atr_Expr AS_Literal(AST lit){\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST tipo;\r
+               if(lit == null) return null;\r
+               switch(lit.getType()){\r
+               case LIT_ENTERO: \r
+                       tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(ENTERO,"entero")));\r
+                       break;\r
+               case LIT_REAL:\r
+                       tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(REAL,"real")));\r
+                       break;\r
+               case LIT_CAR: \r
+                       tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(CARACTER,"caracter")));\r
+                       break;\r
+               case CIERTO:\r
+               case FALSO:\r
+                       tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(LOGICO,"logico")));\r
+                       break;\r
+               default:\r
+                       return null;\r
+               }\r
+               result.setTipo(tipo);\r
+               result.setLVal(false);\r
+               result.setRVal(true);\r
+               return result;\r
+       }\r
+       \r
+       Atr_Expr AS_Acceso_Simple(AST dec){\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST tipo = null;\r
+               if (dec == null) return null;\r
+               switch(dec.getType()){\r
+               case MODULO:\r
+                       System.out.println("ERROR CT: el tipo es modulo");\r
+                       return null;\r
+               case CLASE: //acceso a clase no instanciable\r
+                       tipo = dec;\r
+                       result.setLVal(false);\r
+                       result.setRVal(false);\r
+                       break;\r
+               case ATRIBUTO://acceso a un atributo de la propia clase\r
+                       tipo = dec.getFirstChild().getNextSibling();\r
+                       result.setLVal(true);\r
+                       result.setRVal(true);\r
+                       break;\r
+               case METODO: //acceso a un metodo de la propia clase\r
+                       tipo = dec.getFirstChild();\r
+                       result.setLVal(false);\r
+                       result.setRVal(false);\r
+                       break;\r
+               case PARAMETRO:\r
+                       tipo = dec.getFirstChild().getNextSibling();\r
+                       result.setLVal(false);\r
+                       result.setRVal(true);\r
+                       break;\r
+               case VARIABLE_LOCAL:\r
+                       tipo = dec.getFirstChild().getNextSibling();\r
+                       result.setLVal(true);\r
+                       result.setRVal(true);\r
+                       break;\r
+               case ERROR:\r
+                       return null;\r
+               }\r
+               result.setTipo(tipo);\r
+               return result;\r
+       }\r
+       \r
+       Atr_Expr AS_Acceso_Objeto(Atr_Expr atr_raiz, AST raiz, AST atrib){\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST tipo, tipo_raiz, aux;\r
+               if(atr_raiz == null || raiz == null || atrib ==null) return null;\r
+               //comprobar que el tipo de la raiz sea clase\r
+               tipo_raiz = atr_raiz.getTipo();\r
+               if(tipo_raiz.getType() != CLASE){\r
+                       System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" no es una clase");\r
+                       return null;\r
+               }\r
+               //si la raiz es una clase instanciable\r
+               if(raiz.getFirstChild().getNextSibling().getType() == CLASE){\r
+                       if(tipo_raiz.getFirstChild().getNextSibling().getType() != NO_INST){\r
+                               System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" es una clase instanciable");\r
+                               return null;\r
+                       }\r
+               }\r
+               //si la raiz es un objeto\r
+               else{\r
+                       if(tipo_raiz.getFirstChild().getNextSibling().getType() != INST){\r
+                               System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" es un objeto de clase no instanciable");\r
+                               return null;\r
+                       }\r
+               }\r
+               //comprobar que "atrib" sea un atributo o metodo de la clase y ademas sea visible\r
+               aux = tipo_raiz.getFirstChild().getNextSibling().getNextSibling();\r
+               while(aux!= null){\r
+                       if(aux.getType() == METODO){\r
+                               if(aux.getFirstChild().getFirstChild().equals(atrib))\r
+                                       break;\r
+                       }else{ //atributo\r
+                               if(aux.getFirstChild().equals(atrib))\r
+                                       break;\r
+                       }\r
+                       aux = aux.getNextSibling();\r
+               }\r
+               if(aux == null){\r
+                       System.out.println("ERROR CT: el atributo "+atrib.getText()+" no pertenece a la clase "+raiz.getFirstChild().getText());\r
+                       return null;\r
+               }\r
+               if(aux.getFirstChild().getNextSibling().getNextSibling().getType() != VISIBLE){\r
+                       System.out.println("ERROR CT: el atributo "+atrib.getText()+" no es visible");\r
+                       return null;\r
+               }\r
+               \r
+               //tipo de la expresion\r
+               if(aux.getType() == METODO){\r
+                       tipo = aux.getFirstChild();\r
+                       result.setLVal(false);\r
+                       result.setRVal(false);\r
+               }else{ //atributo\r
+                       tipo = aux.getFirstChild().getNextSibling();\r
+                       result.setLVal(true);\r
+                       result.setRVal(true);\r
+               }\r
+               result.setTipo(tipo);\r
+               return result;\r
+       \r
+       }\r
+       \r
+       //hay que pasarle la raiz para saber el nombre de la raiz cuando no es un metodo\r
+       Atr_Expr AS_Llamada(Atr_Expr atr_raiz, LinkedList expresiones){\r
+               ListIterator it = expresiones.listIterator();\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST pars, par_f, tipo;\r
+               Atr_Expr par_r;\r
+               \r
+               //comprobar que atr_raiz no se a null\r
+               if(atr_raiz == null || expresiones == null){\r
+                       return null;\r
+               }\r
+               //comprobar que la raiz sea de tipo prototipo\r
+               if(atr_raiz.getTipo().getType() != PROTOTIPO){\r
+                       System.out.println("ERROR CT: "+atr_raiz.getTipo().getText()+" no es un metodo.");\r
+                       return null;\r
+               }\r
+               //comprobar que los parametros reales coinciden con los formales\r
+               pars = atr_raiz.getTipo().getFirstChild().getNextSibling();\r
+               par_f = pars.getFirstChild();\r
+               while (it.hasNext() && (par_f != null)){\r
+                       par_r = (Atr_Expr)it.next();\r
+                       if(! par_f.getFirstChild().getNextSibling().equalsTree(par_r.getTipo())){\r
+                               System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
+                               return null;\r
+                       }\r
+                       par_f = par_f.getNextSibling();\r
+               }\r
+               if(it.hasNext() && (par_f == null)){\r
+                       System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
+                       return null;\r
+               }\r
+               if(!it.hasNext() && (par_f != null)){\r
+                       System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
+                       return null;\r
+               }\r
+               //el tipo de la expresion es el rango del metodo\r
+               tipo = atr_raiz.getTipo().getFirstChild().getNextSibling().getNextSibling().getFirstChild();\r
+               result.setLVal(false);\r
+               result.setRVal(true);\r
+               result.setTipo(tipo);\r
+               return result;\r
+       }\r
+       \r
+       Atr_Expr AS_Acceso_Tabla(Atr_Expr atr_raiz, LinkedList expresiones){\r
+               if(atr_raiz == null || expresiones == null) return null;\r
+               ListIterator it = expresiones.listIterator();\r
+               Atr_Expr result = new Atr_Expr();\r
+               Atr_Expr aux;\r
+               AST tipo;\r
+               int tam = 0;\r
+               //comprobar que el tipo de la raizes una formacion\r
+               //TODO\r
+               if(atr_raiz.getTipo().getType() != FORMACION){\r
+                       System.out.println("ERROR CT: intentando acceder a \""+atr_raiz.getTipo().getText()+"\" como formacion");\r
+                       return null;\r
+               }\r
+               //comprobar que el numero de expresiones coincida con el numero  de dimensiones\r
+               while(it.hasNext()){\r
+                       tam++;\r
+                       aux = (Atr_Expr) it.next();\r
+                       if(aux == null) return null;\r
+                       if(aux.getTipo().getType() != ENTERO){\r
+                               System.out.println("ERROR CT: no coinciden el numero de expresiones en el acceso a formacion");\r
+                               return null;\r
+                       }\r
+               }\r
+               if(tam != atr_raiz.getTipo().getFirstChild().getNumberOfChildren()){\r
+                       System.out.println("ERROR CT: no coinciden el numero de expresiones en el acceso a formacion");\r
+                       return null;\r
+               }\r
+               tipo = atr_raiz.getTipo().getFirstChild().getNextSibling();\r
+               result.setTipo(tipo);\r
+               result.setLVal(atr_raiz.getLVal());\r
+               result.setRVal(atr_raiz.getRVal());\r
+               return result;\r
+       }\r
+       \r
+       \r
+       \r
+       //AS DE EXPRESIONES\r
+  \r
+  //Expresiones binarias aritmeticas\r
+  Atr_Expr AS_Exp_Bin_Arit(Atr_Expr e1, Atr_Expr e2){\r
+       Atr_Expr result = new Atr_Expr();\r
+       String men="";\r
+       if(e1 == null || e2 == null) return null;\r
+       \r
+       //Comprobamos que e1 y e2 sean consultables\r
+       if(!e1.getLVal() || !e2.getRVal()){\r
+               if (!e2.getRVal()) men="ERROR LR: la expresion no puede aparecer a la derecha de una expresion binaria" ;\r
+               if (!e1.getLVal()) men="ERROR LR: la expresion no puede aparecer a la izquierda de una expresion binaria" ;\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //Comprobamos que e1 y e2 sean numericas y compatibles\r
+       if((e1.getTipo().getType()!=ENTERO) && (e1.getTipo().getType()!=REAL) ||\r
+       (e2.getTipo().getType()!=ENTERO) && (e2.getTipo().getType()!=REAL)){\r
+               System.out.println("ERROR CT: no son expresiones numericas ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
+               return null;\r
+       }\r
+       if(!e1.getTipo().equals(e2.getTipo())){\r
+               System.out.println("ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
+               return null;\r
+       }\r
+       \r
+       //Calculamos el tipo\r
+       result.setTipo(e1.getTipo());\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  \r
+  //Expresiones binarias logicas\r
+  Atr_Expr AS_Exp_Bin_Log(Atr_Expr e1, Atr_Expr e2){\r
+       Atr_Expr result = new Atr_Expr();\r
+       String men = "";\r
+       \r
+       if(e1 == null || e2 == null) return null;\r
+       //Comprobar que las expresiones son consultables\r
+       if(!e1.getLVal() || !e2.getRVal()){\r
+               if (!e2.getRVal()) men ="ERROR LR: la expresion no puede aparecer a la derecha de la expresion" ;\r
+               if (!e1.getLVal()) men ="ERROR LR: la expresion "+e1.getTipo().getFirstChild().getText()+" no puede aparecer a la izquierda de la expresion" ;\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //Comprobamos que sean de tipo logico\r
+       if((e1.getTipo().getType()!=LOGICO) || (e2.getTipo().getType()!=LOGICO)){\r
+               if (e1.getTipo().getType()!=LOGICO)\r
+                       men = "ERROR CT: la expresion "+e1.getTipo().getFirstChild().getText()+"no es de tipo logico";\r
+               if (e2.getTipo().getType()!=LOGICO)\r
+                       men = "ERROR CT: la expresion "+e2.getTipo().getFirstChild().getText()+"no es de tipo logico";\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //Calculamos el tipo\r
+       result.setTipo(e1.getTipo());\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  //Expresiones binarias relacionales\r
+  Atr_Expr AS_Exp_Bin_Rel(Atr_Expr e1, Atr_Expr e2, AST operador){\r
+       Atr_Expr result = new Atr_Expr();\r
+       AST tipo;\r
+       String men = "";\r
+       \r
+       if(e1 == null || e2 == null || operador == null) return null;\r
+       //Comprobamos que las expresiones son consultables\r
+       if(!e1.getLVal() || !e2.getRVal()){\r
+               if (!e2.getRVal()) men ="ERROR LR: la expresion no se puede consultar en la expresion binaria" ;\r
+               if (!e1.getLVal()) men ="ERROR LR: la expresion "+e1.getTipo().getFirstChild().getText()+" no puede aparecer a la izquierda en la expresion";\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //No dejamos que se utilicen formaciones y comprobamos la compatibilidad de las expresiones\r
+       if(e1.getTipo().getType()==FORMACION){\r
+               System.out.println("ERROR CT: no puede tener formaciones en expresiones relacionales");\r
+               return null;\r
+       }\r
+       men = "ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")";\r
+       if(!e1.getTipo().equals(e2.getTipo())){\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+\r
+       if((e1.getTipo().getType() == CLASE) && (!e1.getTipo().getFirstChild().equals(e2.getTipo().getFirstChild()))){ //Comparamos las clases por nombre\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //Miramos los grupos de operadores\r
+       if((operador.getType()!=IGUAL && operador.getType()!=DISTINTO) && (e1.getTipo().getType()==CLASE || e1.getTipo().getType()==LOGICO)){\r
+               System.out.println("ERROR CT: el operador \""+operador.getText()+"\" no esta permitido para los tipos usados ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
+               return null;\r
+       }\r
+       \r
+       //Establecemos el tipo\r
+       tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(LOGICO,"logico")));\r
+       result.setTipo(tipo);\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  //Expresiones unarias aritmeticas == MENOS UNARIO\r
+  Atr_Expr AS_Exp_Una_Arit(Atr_Expr e){\r
+       Atr_Expr result = new Atr_Expr();\r
+       String men="";\r
+       \r
+       if(e == null) return null;\r
+       //e tiene que ser consultable\r
+       if(!e.getRVal()){\r
+               men ="ERROR LR: la expresion no es consultable" ;\r
+               System.out.println(men);\r
+               return null;\r
+       }\r
+       \r
+       //comprobar que e es de tipo numerico\r
+       if( e.getTipo().getType()!=ENTERO && e.getTipo().getType()!=REAL){\r
+               System.out.println("ERROR CT: el menos unario solo puede ser utilizado en expresiones numericas");\r
+               return null;\r
+       }\r
+       \r
+       //Establecemos el tipo\r
+       result.setTipo(e.getTipo());\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  //Expresiones unarias logicas == NEGACION\r
+  //Identica a la anterior\r
+  Atr_Expr AS_Exp_Una_Log(Atr_Expr e){\r
+       Atr_Expr result = new Atr_Expr();\r
+       \r
+       if(e == null) return null;\r
+       //e tiene que ser consultable\r
+       if(!e.getRVal()){\r
+               System.out.println("ERROR LR: la expresion no es consultable" );\r
+               return null;\r
+       }\r
+       \r
+       //comprobar que e es de tipo numerico\r
+       if( e.getTipo().getType()!=LOGICO){\r
+               System.out.println("ERROR CT: la negacion solo se puede utilizar con expresiones logicas");\r
+               return null;\r
+       }\r
+       \r
+       //Establecemos el tipo\r
+       result.setTipo(e.getTipo());\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       \r
+       return result;\r
+  }\r
+  \r
+  //Instrucciones\r
+  //Asignacion\r
+  void AS_Asignacion(Atr_Expr e1, Atr_Expr e2, AST e3, AST e4){\r
+       //comprobar si alguno es null\r
+       String men = "";\r
+       if(e1==null || e2 == null) return;\r
+               \r
+       //Comprobamos la consultabilidad de las expresiones\r
+       if(!e1.getLVal() || !e2.getRVal()){\r
+               if (!e2.getRVal())\r
+                       men ="ERROR LR: la expresion "+e4.getFirstChild().getText()+" no puede aparecer a la derecha de una asignacion." ;\r
+               if (!e1.getLVal()) men ="ERROR LR: el "+e3.getFirstChild().getNextSibling().getText()+" "+e3.getFirstChild().getText()+" no puede aparecer a la izquierda de una asignacion." ;\r
+               System.out.println(men);\r
+               return;\r
+       }\r
+       \r
+       //No dejamos asignar formaciones y comprobamos la compatibilidad de tipos\r
+       if(e1.getTipo().getType()==FORMACION){\r
+               System.out.println("ERROR CT: no dejamos asignar formaciones");\r
+       }\r
+       men = "ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")";\r
+       if(!e1.getTipo().equals(e2.getTipo())){\r
+               System.out.println(men);\r
+       }\r
+       if((e1.getTipo().getType() == CLASE) && (!e1.getTipo().getFirstChild().equals(e2.getTipo().getFirstChild()))){ //Comparamos las clases por nombre\r
+               System.out.println(men);\r
+       }\r
+  }\r
+  \r
+  //Condiciones\r
+  void AS_Condicional(Atr_Expr e){\r
+       String men = "";\r
+       if (e == null) return;\r
+       if(!e.getRVal()){\r
+               men ="ERROR LR: la expresion no es consultable" ;\r
+               System.out.println(men);\r
+               return;\r
+       }\r
+       \r
+       //Comprobamos que es de tipo logico\r
+       if(e.getTipo().getType()!=LOGICO){\r
+               System.out.println("ERROR CT: no es un tipo logico");\r
+       }\r
+  }\r
+  \r
+  //Instruccion de devolucion\r
+  int AS_Devolucion(AST tipo_dev, Atr_Expr e, int cont){\r
+       String men = "";\r
+//  String men = "ERROR CT: Los tipos no son compatibles (entero y real)"\r
+       if(tipo_dev == null || e == null) return cont+1;\r
+       //Comprobamos que el metodo sea funcional\r
+\r
+       if(cont == -1){\r
+               System.out.println("ERROR CT: el metodo no es funcional");\r
+               return -1;\r
+       }\r
+\r
+       //Comprobar que la expresion e es consultable\r
+       if(!e.getRVal()){\r
+               System.out.println("ERROR CT: la expresion no es consultable, no se puede devolver");\r
+       }\r
+       \r
+       men = "ERROR CT: Los tipos no son compatibles ("+e.getTipo().getText()+" y "+tipo_dev.getText()+")";\r
+       //Comprobamos que el tipo de la expresion es compatible con el tipo que se devuelve\r
+       if(!e.getTipo().equals(tipo_dev)){\r
+               System.out.println(men);\r
+       }\r
+       if(tipo_dev.getType()==CLASE && (!tipo_dev.getFirstChild().equals(e.getTipo().getFirstChild()))){\r
+               System.out.println(men);\r
+       }\r
+       \r
+       if(tipo_dev.getType()==FORMACION && (!tipo_dev.equals(e.getTipo()))){\r
+               System.out.println(men);\r
+       }\r
+       \r
+       return cont + 1;\r
+  }\r
+  \r
+  \r
+  Atr_Expr AS_Crear(Atr_Expr as, AST clase){\r
+               if (as == null || clase == null){\r
+                       System.out.println("ERROR CT: no se puede crear");\r
+                        return null;\r
+               }\r
+               //comprobar que el tipo de la variable es el mismo que el del interior de crear\r
+               Atr_Expr result = new Atr_Expr();\r
+               AST tipo = as.getTipo();\r
+               if(tipo.getType() != CLASE){\r
+                       System.out.println("ERROR CT: no es una clase");\r
+                       return null;\r
+               }\r
+               if(!(tipo.getFirstChild().getNextSibling().getType() == INST)){\r
+                       System.out.println("ERROR CT: la clase no es instanciable");\r
+                       return null;\r
+               }\r
+               AST tipo_var = tipo.getFirstChild();\r
+               AST interior = clase;\r
+               if(!tipo_var.getText().equals(interior.getText())){\r
+                       if(interior.getType() == ACCESO_SIMPLE)\r
+                               System.out.println("ERROR CT: Los tipos no son compatibles ("+tipo_var.getText()+" y "+interior.getFirstChild().getText()+")");\r
+                       else\r
+                               System.out.println("ERROR CT: Los tipos no son compatibles ("+tipo_var.getText()+" y "+interior.getText()+")");\r
+                       return null;\r
+               }\r
+               //hay que comprobar que la clase es instanciable, y que el tipo es clase\r
+\r
+               result.setLVal(false);\r
+               result.setRVal(false);\r
+               //el tipo es el de la variable\r
+               result.setTipo(tipo);\r
+               \r
+               return result;\r
+       }       \r
+       \r
+       //AS Escribir\r
+       void AS_Escribir(Atr_Expr e, AST exp){\r
+               if (e == null){\r
+                       if(exp.getType() == ACCESO_SIMPLE)\r
+                               System.out.println("ERROR CT: no se puede escribir "+ exp.getFirstChild().getText());\r
+                       else\r
+                               System.out.println("ERROR CT: no se puede escribir "+ exp.getText());\r
+                       return;\r
+               }\r
+               //Comprobamos que la expresion se pueda consultar\r
+               if(!e.getRVal()){\r
+                       System.out.println("ERROR CT: la expresion no es consultable, no se puede escribir");\r
+               }\r
+       }\r
+\r
+  \r
+  //AS Entero A Real\r
+  Atr_Expr AS_Entero_A_Real(Atr_Expr e1){\r
+       Atr_Expr result = new Atr_Expr();\r
+       if (e1 == null) return null;\r
+       AST tipo = e1.getTipo();\r
+       if(tipo.getType() != ENTERO){\r
+               System.out.println("ERROR CT: El tipo del parametro del operador enteroareal es incorrecto.");\r
+               return null;\r
+         }\r
+       result.setTipo((AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(REAL,"real"))));\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       return result;\r
+  }\r
+  Atr_Expr AS_Real_A_Entero(Atr_Expr e1){\r
+       Atr_Expr result = new Atr_Expr();\r
+       \r
+       if (e1 == null) return null;\r
+       AST tipo = e1.getTipo();\r
+       if(tipo.getType() != REAL){\r
+               System.out.println("ERROR CT: El tipo del parametro del operador realaentero es incorrecto.");\r
+               return null;\r
+       }\r
+       result.setTipo((AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(ENTERO,"entero"))));\r
+       result.setLVal(false);\r
+       result.setRVal(true);\r
+       return result;\r
+  }\r
+  \r
+  \r
+public AnaSem() {
+       tokenNames = _tokenNames;
+}
+
+       public final void declaracion_modulo(AST _t) throws RecognitionException {
+               
+               AST declaracion_modulo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_modulo_AST = null;
+               
+               try {      // for error handling
+                       AST __t9810 = _t;
+                       AST tmp1_AST = null;
+                       AST tmp1_AST_in = null;
+                       tmp1_AST = astFactory.create((AST)_t);
+                       tmp1_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp1_AST);
+                       ASTPair __currentAST9810 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,MODULO);
+                       _t = _t.getFirstChild();
+                       nombre_modulo(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       definicion_modulo(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9810;
+                       _t = __t9810;
+                       _t = _t.getNextSibling();
+                       declaracion_modulo_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_modulo_AST;
+               _retTree = _t;
+       }
+       
+       public final void nombre_modulo(AST _t) throws RecognitionException {
+               
+               AST nombre_modulo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST nombre_modulo_AST = null;
+               
+               try {      // for error handling
+                       AST tmp2_AST = null;
+                       AST tmp2_AST_in = null;
+                       tmp2_AST = astFactory.create((AST)_t);
+                       tmp2_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp2_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       nombre_modulo_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = nombre_modulo_AST;
+               _retTree = _t;
+       }
+       
+       public final void definicion_modulo(AST _t) throws RecognitionException {
+               
+               AST definicion_modulo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST definicion_modulo_AST = null;
+               
+               try {      // for error handling
+                       lista_declaraciones_clases(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       definicion_modulo_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = definicion_modulo_AST;
+               _retTree = _t;
+       }
+       
+       public final void lista_declaraciones_clases(AST _t) throws RecognitionException {
+               
+               AST lista_declaraciones_clases_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST lista_declaraciones_clases_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9815:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==CLASE)) {
+                                       declaracion_clase(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9815;
+                               }
+                               
+                       } while (true);
+                       }
+                       lista_declaraciones_clases_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = lista_declaraciones_clases_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_clase(AST _t) throws RecognitionException {
+               
+               AST declaracion_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_clase_AST = null;
+               
+               try {      // for error handling
+                       AST __t9817 = _t;
+                       AST tmp3_AST = null;
+                       AST tmp3_AST_in = null;
+                       tmp3_AST = astFactory.create((AST)_t);
+                       tmp3_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp3_AST);
+                       ASTPair __currentAST9817 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,CLASE);
+                       _t = _t.getFirstChild();
+                       nombre_clase(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       cualificador_clase(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       definicion_clase(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9817;
+                       _t = __t9817;
+                       _t = _t.getNextSibling();
+                       declaracion_clase_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_clase_AST;
+               _retTree = _t;
+       }
+       
+       public final void nombre_clase(AST _t) throws RecognitionException {
+               
+               AST nombre_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST nombre_clase_AST = null;
+               
+               try {      // for error handling
+                       AST tmp4_AST = null;
+                       AST tmp4_AST_in = null;
+                       tmp4_AST = astFactory.create((AST)_t);
+                       tmp4_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp4_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       nombre_clase_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = nombre_clase_AST;
+               _retTree = _t;
+       }
+       
+       public final void cualificador_clase(AST _t) throws RecognitionException {
+               
+               AST cualificador_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST cualificador_clase_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case INST:
+                       {
+                               AST tmp5_AST = null;
+                               AST tmp5_AST_in = null;
+                               tmp5_AST = astFactory.create((AST)_t);
+                               tmp5_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp5_AST);
+                               match(_t,INST);
+                               _t = _t.getNextSibling();
+                               cualificador_clase_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case NO_INST:
+                       {
+                               AST tmp6_AST = null;
+                               AST tmp6_AST_in = null;
+                               tmp6_AST = astFactory.create((AST)_t);
+                               tmp6_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp6_AST);
+                               match(_t,NO_INST);
+                               _t = _t.getNextSibling();
+                               cualificador_clase_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = cualificador_clase_AST;
+               _retTree = _t;
+       }
+       
+       public final void definicion_clase(AST _t) throws RecognitionException {
+               
+               AST definicion_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST definicion_clase_AST = null;
+               
+               try {      // for error handling
+                       declaraciones_elementos_clase(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       definicion_clase_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = definicion_clase_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaraciones_elementos_clase(AST _t) throws RecognitionException {
+               
+               AST declaraciones_elementos_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaraciones_elementos_clase_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9823:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==ATRIBUTO||_t.getType()==METODO)) {
+                                       declaracion_elemento_clase(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9823;
+                               }
+                               
+                       } while (true);
+                       }
+                       declaraciones_elementos_clase_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaraciones_elementos_clase_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_elemento_clase(AST _t) throws RecognitionException {
+               
+               AST declaracion_elemento_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_elemento_clase_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case METODO:
+                       {
+                               AST __t9825 = _t;
+                               AST tmp7_AST = null;
+                               AST tmp7_AST_in = null;
+                               tmp7_AST = astFactory.create((AST)_t);
+                               tmp7_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp7_AST);
+                               ASTPair __currentAST9825 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,METODO);
+                               _t = _t.getFirstChild();
+                               declaracion_metodo(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               cualificador_elemento_clase(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9825;
+                               _t = __t9825;
+                               _t = _t.getNextSibling();
+                               declaracion_elemento_clase_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ATRIBUTO:
+                       {
+                               AST __t9826 = _t;
+                               AST tmp8_AST = null;
+                               AST tmp8_AST_in = null;
+                               tmp8_AST = astFactory.create((AST)_t);
+                               tmp8_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp8_AST);
+                               ASTPair __currentAST9826 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,ATRIBUTO);
+                               _t = _t.getFirstChild();
+                               AST tmp9_AST = null;
+                               AST tmp9_AST_in = null;
+                               tmp9_AST = astFactory.create((AST)_t);
+                               tmp9_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp9_AST);
+                               match(_t,IDENT);
+                               _t = _t.getNextSibling();
+                               tipo(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               cualificador_elemento_clase(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9826;
+                               _t = __t9826;
+                               _t = _t.getNextSibling();
+                               declaracion_elemento_clase_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_elemento_clase_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_metodo(AST _t) throws RecognitionException {
+               
+               AST declaracion_metodo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_metodo_AST = null;
+               AST tipodev;
+               
+               try {      // for error handling
+                       tipodev=prototipo_metodo(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       definicion_metodo(_t,tipodev);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       if (cont_dev == 0){
+                               System.out.println("ERROR: Metodo funcional que no devuelve nada");
+                               System.exit(-1);
+                       }
+                       
+                       declaracion_metodo_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_metodo_AST;
+               _retTree = _t;
+       }
+       
+       public final void cualificador_elemento_clase(AST _t) throws RecognitionException {
+               
+               AST cualificador_elemento_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST cualificador_elemento_clase_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case OCULTO:
+                       {
+                               AST tmp10_AST = null;
+                               AST tmp10_AST_in = null;
+                               tmp10_AST = astFactory.create((AST)_t);
+                               tmp10_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp10_AST);
+                               match(_t,OCULTO);
+                               _t = _t.getNextSibling();
+                               cualificador_elemento_clase_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case VISIBLE:
+                       {
+                               AST tmp11_AST = null;
+                               AST tmp11_AST_in = null;
+                               tmp11_AST = astFactory.create((AST)_t);
+                               tmp11_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp11_AST);
+                               match(_t,VISIBLE);
+                               _t = _t.getNextSibling();
+                               cualificador_elemento_clase_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = cualificador_elemento_clase_AST;
+               _retTree = _t;
+       }
+       
+       public final void tipo(AST _t) throws RecognitionException {
+               
+               AST tipo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST tipo_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case ENTERO:
+                       case REAL:
+                       case LOGICO:
+                       case CARACTER:
+                       {
+                               tipo_predefinido_simple(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               tipo_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case FORMACION:
+                       {
+                               tipo_predefinido_compuesto(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               tipo_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case CLASE:
+                       {
+                               declaracion_clase1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               tipo_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ERROR:
+                       {
+                               declaracion_error(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               tipo_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = tipo_AST;
+               _retTree = _t;
+       }
+       
+       public final AST  prototipo_metodo(AST _t) throws RecognitionException {
+               AST tipodev=null;
+               
+               AST prototipo_metodo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST prototipo_metodo_AST = null;
+               AST t_AST = null;
+               AST t = null;
+               AST v = null;
+               AST v_AST = null;
+               
+               try {      // for error handling
+                       AST __t9830 = _t;
+                       AST tmp12_AST = null;
+                       AST tmp12_AST_in = null;
+                       tmp12_AST = astFactory.create((AST)_t);
+                       tmp12_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp12_AST);
+                       ASTPair __currentAST9830 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,PROTOTIPO);
+                       _t = _t.getFirstChild();
+                       AST tmp13_AST = null;
+                       AST tmp13_AST_in = null;
+                       tmp13_AST = astFactory.create((AST)_t);
+                       tmp13_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp13_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       AST __t9831 = _t;
+                       AST tmp14_AST = null;
+                       AST tmp14_AST_in = null;
+                       tmp14_AST = astFactory.create((AST)_t);
+                       tmp14_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp14_AST);
+                       ASTPair __currentAST9831 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,PARAMETROS);
+                       _t = _t.getFirstChild();
+                       declaracion_parametros(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9831;
+                       _t = __t9831;
+                       _t = _t.getNextSibling();
+                       AST __t9832 = _t;
+                       AST tmp15_AST = null;
+                       AST tmp15_AST_in = null;
+                       tmp15_AST = astFactory.create((AST)_t);
+                       tmp15_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp15_AST);
+                       ASTPair __currentAST9832 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,RESULTADO);
+                       _t = _t.getFirstChild();
+                       {
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case ERROR:
+                       case CLASE:
+                       case ENTERO:
+                       case REAL:
+                       case LOGICO:
+                       case CARACTER:
+                       case FORMACION:
+                       {
+                               t = _t==ASTNULL ? null : (AST)_t;
+                               tipo(_t);
+                               _t = _retTree;
+                               t_AST = (AST)returnAST;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               cont_dev = 0; // inicializa el contador de instrucciones DEV
+                               tipodev = t;
+                               break;
+                       }
+                       case VACIO:
+                       {
+                               v = (AST)_t;
+                               AST v_AST_in = null;
+                               v_AST = astFactory.create(v);
+                               astFactory.addASTChild(currentAST, v_AST);
+                               match(_t,VACIO);
+                               _t = _t.getNextSibling();
+                               cont_dev = -1; // marca a -1 para indicar que es un procedimiento
+                               tipodev = v;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+                       }
+                       currentAST = __currentAST9832;
+                       _t = __t9832;
+                       _t = _t.getNextSibling();
+                       currentAST = __currentAST9830;
+                       _t = __t9830;
+                       _t = _t.getNextSibling();
+                       prototipo_metodo_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = prototipo_metodo_AST;
+               _retTree = _t;
+               return tipodev;
+       }
+       
+       public final void definicion_metodo(AST _t,
+               AST tipodev
+       ) throws RecognitionException {
+               
+               AST definicion_metodo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST definicion_metodo_AST = null;
+               
+               try {      // for error handling
+                       AST __t9840 = _t;
+                       AST tmp16_AST = null;
+                       AST tmp16_AST_in = null;
+                       tmp16_AST = astFactory.create((AST)_t);
+                       tmp16_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp16_AST);
+                       ASTPair __currentAST9840 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,DEFINICION);
+                       _t = _t.getFirstChild();
+                       AST __t9841 = _t;
+                       AST tmp17_AST = null;
+                       AST tmp17_AST_in = null;
+                       tmp17_AST = astFactory.create((AST)_t);
+                       tmp17_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp17_AST);
+                       ASTPair __currentAST9841 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,VARIABLES_LOCALES);
+                       _t = _t.getFirstChild();
+                       declaracion_variables_locales(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9841;
+                       _t = __t9841;
+                       _t = _t.getNextSibling();
+                       AST __t9842 = _t;
+                       AST tmp18_AST = null;
+                       AST tmp18_AST_in = null;
+                       tmp18_AST = astFactory.create((AST)_t);
+                       tmp18_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp18_AST);
+                       ASTPair __currentAST9842 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,INSTRUCCIONES);
+                       _t = _t.getFirstChild();
+                       instrucciones(_t,tipodev);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9842;
+                       _t = __t9842;
+                       _t = _t.getNextSibling();
+                       currentAST = __currentAST9840;
+                       _t = __t9840;
+                       _t = _t.getNextSibling();
+                       definicion_metodo_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = definicion_metodo_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_parametros(AST _t) throws RecognitionException {
+               
+               AST declaracion_parametros_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_parametros_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9836:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==PARAMETRO)) {
+                                       declaracion_parametro(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9836;
+                               }
+                               
+                       } while (true);
+                       }
+                       declaracion_parametros_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_parametros_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_parametro(AST _t) throws RecognitionException {
+               
+               AST declaracion_parametro_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_parametro_AST = null;
+               
+               try {      // for error handling
+                       AST __t9838 = _t;
+                       AST tmp19_AST = null;
+                       AST tmp19_AST_in = null;
+                       tmp19_AST = astFactory.create((AST)_t);
+                       tmp19_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp19_AST);
+                       ASTPair __currentAST9838 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,PARAMETRO);
+                       _t = _t.getFirstChild();
+                       AST tmp20_AST = null;
+                       AST tmp20_AST_in = null;
+                       tmp20_AST = astFactory.create((AST)_t);
+                       tmp20_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp20_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       tipo(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9838;
+                       _t = __t9838;
+                       _t = _t.getNextSibling();
+                       declaracion_parametro_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_parametro_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_variables_locales(AST _t) throws RecognitionException {
+               
+               AST declaracion_variables_locales_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_variables_locales_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9845:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==VARIABLE_LOCAL)) {
+                                       declaracion_variable_local(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9845;
+                               }
+                               
+                       } while (true);
+                       }
+                       declaracion_variables_locales_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_variables_locales_AST;
+               _retTree = _t;
+       }
+       
+       public final void instrucciones(AST _t,
+               AST tipodev
+       ) throws RecognitionException {
+               
+               AST instrucciones_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST instrucciones_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9851:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==INSTRUCCION)) {
+                                       instruccion(_t,tipodev);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9851;
+                               }
+                               
+                       } while (true);
+                       }
+                       instrucciones_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = instrucciones_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_variable_local(AST _t) throws RecognitionException {
+               
+               AST declaracion_variable_local_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_variable_local_AST = null;
+               
+               try {      // for error handling
+                       AST __t9847 = _t;
+                       AST tmp21_AST = null;
+                       AST tmp21_AST_in = null;
+                       tmp21_AST = astFactory.create((AST)_t);
+                       tmp21_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp21_AST);
+                       ASTPair __currentAST9847 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,VARIABLE_LOCAL);
+                       _t = _t.getFirstChild();
+                       AST tmp22_AST = null;
+                       AST tmp22_AST_in = null;
+                       tmp22_AST = astFactory.create((AST)_t);
+                       tmp22_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp22_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       tipo(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9847;
+                       _t = __t9847;
+                       _t = _t.getNextSibling();
+                       declaracion_variable_local_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_variable_local_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_error(AST _t) throws RecognitionException {
+               
+               AST declaracion_error_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_error_AST = null;
+               
+               try {      // for error handling
+                       AST tmp23_AST = null;
+                       AST tmp23_AST_in = null;
+                       tmp23_AST = astFactory.create((AST)_t);
+                       tmp23_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp23_AST);
+                       match(_t,ERROR);
+                       _t = _t.getNextSibling();
+                       declaracion_error_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_error_AST;
+               _retTree = _t;
+       }
+       
+       public final void instruccion(AST _t,
+               AST tipodev
+       ) throws RecognitionException {
+               
+               AST instruccion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST instruccion_AST = null;
+               
+               try {      // for error handling
+                       AST __t9853 = _t;
+                       AST tmp24_AST = null;
+                       AST tmp24_AST_in = null;
+                       tmp24_AST = astFactory.create((AST)_t);
+                       tmp24_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp24_AST);
+                       ASTPair __currentAST9853 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,INSTRUCCION);
+                       _t = _t.getFirstChild();
+                       {
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case LLAMADA:
+                       case DEV:
+                       case ASIGNACION:
+                       case CREAR:
+                       case ESCRIBIR:
+                       {
+                               instruccion_simple(_t,tipodev);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               break;
+                       }
+                       case SI:
+                       case MIENTRAS:
+                       {
+                               instruccion_compuesta(_t,tipodev);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+                       }
+                       currentAST = __currentAST9853;
+                       _t = __t9853;
+                       _t = _t.getNextSibling();
+                       instruccion_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = instruccion_AST;
+               _retTree = _t;
+       }
+       
+       public final void instruccion_simple(AST _t,
+               AST tipodev
+       ) throws RecognitionException {
+               
+               AST instruccion_simple_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST instruccion_simple_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case CREAR:
+                       {
+                               crear(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case LLAMADA:
+                       {
+                               llamada_metodo(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ESCRIBIR:
+                       {
+                               escribir(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ASIGNACION:
+                       {
+                               asignacion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case DEV:
+                       {
+                               retorno(_t,tipodev);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = instruccion_simple_AST;
+               _retTree = _t;
+       }
+       
+       public final void instruccion_compuesta(AST _t,
+               AST tipodev
+       ) throws RecognitionException {
+               
+               AST instruccion_compuesta_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST instruccion_compuesta_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case SI:
+                       {
+                               condicion(_t,tipodev);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_compuesta_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MIENTRAS:
+                       {
+                               iteracion(_t,tipodev);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_compuesta_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = instruccion_compuesta_AST;
+               _retTree = _t;
+       }
+       
+       public final void crear(AST _t) throws RecognitionException {
+               
+               AST crear_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST crear_AST = null;
+               AST e2_AST = null;
+               AST e2 = null;
+               Atr_Expr e1;
+               
+               try {      // for error handling
+                       AST __t9857 = _t;
+                       AST tmp25_AST = null;
+                       AST tmp25_AST_in = null;
+                       tmp25_AST = astFactory.create((AST)_t);
+                       tmp25_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp25_AST);
+                       ASTPair __currentAST9857 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,CREAR);
+                       _t = _t.getFirstChild();
+                       e1=expresion(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       e2 = _t==ASTNULL ? null : (AST)_t;
+                       expresion(_t);
+                       _t = _retTree;
+                       e2_AST = (AST)returnAST;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9857;
+                       _t = __t9857;
+                       _t = _t.getNextSibling();
+                       AS_Crear(e1,e2_AST);
+                       crear_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = crear_AST;
+               _retTree = _t;
+       }
+       
+       public final void llamada_metodo(AST _t) throws RecognitionException {
+               
+               AST llamada_metodo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST llamada_metodo_AST = null;
+               Atr_Expr a, res; LinkedList l;
+               
+               try {      // for error handling
+                       AST __t9866 = _t;
+                       AST tmp26_AST = null;
+                       AST tmp26_AST_in = null;
+                       tmp26_AST = astFactory.create((AST)_t);
+                       tmp26_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp26_AST);
+                       ASTPair __currentAST9866 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,LLAMADA);
+                       _t = _t.getFirstChild();
+                       a=acceso(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       AST __t9867 = _t;
+                       AST tmp27_AST = null;
+                       AST tmp27_AST_in = null;
+                       tmp27_AST = astFactory.create((AST)_t);
+                       tmp27_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp27_AST);
+                       ASTPair __currentAST9867 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,EXPRESIONES);
+                       _t = _t.getFirstChild();
+                       l=lista_expresiones(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9867;
+                       _t = __t9867;
+                       _t = _t.getNextSibling();
+                       currentAST = __currentAST9866;
+                       _t = __t9866;
+                       _t = _t.getNextSibling();
+                       res=AS_Llamada(a,l);
+                       if (res != null && res.getTipo().getType() != VACIO){
+                               System.out.println("ERROR: Llamada a funcion sin asignar valor devuelto.");
+                               System.exit(1); 
+                       } 
+                       
+                       llamada_metodo_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = llamada_metodo_AST;
+               _retTree = _t;
+       }
+       
+       public final void escribir(AST _t) throws RecognitionException {
+               
+               AST escribir_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST escribir_AST = null;
+               AST e_AST = null;
+               AST e = null;
+               Atr_Expr e1;
+               
+               try {      // for error handling
+                       AST __t9859 = _t;
+                       AST tmp28_AST = null;
+                       AST tmp28_AST_in = null;
+                       tmp28_AST = astFactory.create((AST)_t);
+                       tmp28_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp28_AST);
+                       ASTPair __currentAST9859 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,ESCRIBIR);
+                       _t = _t.getFirstChild();
+                       e = _t==ASTNULL ? null : (AST)_t;
+                       e1=expresion(_t);
+                       _t = _retTree;
+                       e_AST = (AST)returnAST;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9859;
+                       _t = __t9859;
+                       _t = _t.getNextSibling();
+                       AS_Escribir(e1, e_AST);
+                       escribir_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = escribir_AST;
+               _retTree = _t;
+       }
+       
+       public final void asignacion(AST _t) throws RecognitionException {
+               
+               AST asignacion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST asignacion_AST = null;
+               AST e3_AST = null;
+               AST e3 = null;
+               AST e4_AST = null;
+               AST e4 = null;
+               Atr_Expr e1, e2;
+               
+               try {      // for error handling
+                       AST __t9862 = _t;
+                       AST tmp29_AST = null;
+                       AST tmp29_AST_in = null;
+                       tmp29_AST = astFactory.create((AST)_t);
+                       tmp29_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp29_AST);
+                       ASTPair __currentAST9862 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,ASIGNACION);
+                       _t = _t.getFirstChild();
+                       e3 = _t==ASTNULL ? null : (AST)_t;
+                       e1=expresion(_t);
+                       _t = _retTree;
+                       e3_AST = (AST)returnAST;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       e4 = _t==ASTNULL ? null : (AST)_t;
+                       e2=expresion(_t);
+                       _t = _retTree;
+                       e4_AST = (AST)returnAST;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9862;
+                       _t = __t9862;
+                       _t = _t.getNextSibling();
+                               AS_Asignacion(e1,e2,e3_AST,e4_AST);
+                       
+                       asignacion_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = asignacion_AST;
+               _retTree = _t;
+       }
+       
+       public final void retorno(AST _t,
+               AST tipodev
+       ) throws RecognitionException {
+               
+               AST retorno_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST retorno_AST = null;
+               Atr_Expr e;
+               
+               try {      // for error handling
+                       AST __t9864 = _t;
+                       AST tmp30_AST = null;
+                       AST tmp30_AST_in = null;
+                       tmp30_AST = astFactory.create((AST)_t);
+                       tmp30_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp30_AST);
+                       ASTPair __currentAST9864 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,DEV);
+                       _t = _t.getFirstChild();
+                       e=expresion(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9864;
+                       _t = __t9864;
+                       _t = _t.getNextSibling();
+                       /*AS_Devolucion(tipodev, e);
+                       cont_dev++;*/
+                       cont_dev=AS_Devolucion(tipodev,e,cont_dev);
+                       
+                       retorno_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = retorno_AST;
+               _retTree = _t;
+       }
+       
+       public final Atr_Expr  expresion(AST _t) throws RecognitionException {
+               Atr_Expr res=null;
+               
+               AST expresion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST expresion_AST = null;
+               AST op1 = null;
+               AST op1_AST = null;
+               AST op2 = null;
+               AST op2_AST = null;
+               AST op3 = null;
+               AST op3_AST = null;
+               AST op4 = null;
+               AST op4_AST = null;
+               AST op5 = null;
+               AST op5_AST = null;
+               AST op6 = null;
+               AST op6_AST = null;
+               AST i = null;
+               AST i_AST = null;
+               AST j = null;
+               AST j_AST = null;
+               AST k = null;
+               AST k_AST = null;
+               AST m = null;
+               AST m_AST = null;
+               AST n = null;
+               AST n_AST = null;
+               Atr_Expr e1,e2; LinkedList l;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case O:
+                       {
+                               AST __t9880 = _t;
+                               AST tmp31_AST = null;
+                               AST tmp31_AST_in = null;
+                               tmp31_AST = astFactory.create((AST)_t);
+                               tmp31_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp31_AST);
+                               ASTPair __currentAST9880 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,O);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9880;
+                               _t = __t9880;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Log( e1, e2);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case Y:
+                       {
+                               AST __t9881 = _t;
+                               AST tmp32_AST = null;
+                               AST tmp32_AST_in = null;
+                               tmp32_AST = astFactory.create((AST)_t);
+                               tmp32_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp32_AST);
+                               ASTPair __currentAST9881 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,Y);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9881;
+                               _t = __t9881;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Log( e1, e2);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case NO:
+                       {
+                               AST __t9882 = _t;
+                               AST tmp33_AST = null;
+                               AST tmp33_AST_in = null;
+                               tmp33_AST = astFactory.create((AST)_t);
+                               tmp33_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp33_AST);
+                               ASTPair __currentAST9882 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,NO);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9882;
+                               _t = __t9882;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Una_Log( e1);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MAYOR:
+                       {
+                               AST __t9883 = _t;
+                               op1 = _t==ASTNULL ? null :(AST)_t;
+                               AST op1_AST_in = null;
+                               op1_AST = astFactory.create(op1);
+                               astFactory.addASTChild(currentAST, op1_AST);
+                               ASTPair __currentAST9883 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MAYOR);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9883;
+                               _t = __t9883;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Rel( e1, e2, op1);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MAYOR_IGUAL:
+                       {
+                               AST __t9884 = _t;
+                               op2 = _t==ASTNULL ? null :(AST)_t;
+                               AST op2_AST_in = null;
+                               op2_AST = astFactory.create(op2);
+                               astFactory.addASTChild(currentAST, op2_AST);
+                               ASTPair __currentAST9884 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MAYOR_IGUAL);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9884;
+                               _t = __t9884;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Rel( e1, e2, op2);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MENOR:
+                       {
+                               AST __t9885 = _t;
+                               op3 = _t==ASTNULL ? null :(AST)_t;
+                               AST op3_AST_in = null;
+                               op3_AST = astFactory.create(op3);
+                               astFactory.addASTChild(currentAST, op3_AST);
+                               ASTPair __currentAST9885 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MENOR);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9885;
+                               _t = __t9885;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Rel( e1, e2, op3);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MENOR_IGUAL:
+                       {
+                               AST __t9886 = _t;
+                               op4 = _t==ASTNULL ? null :(AST)_t;
+                               AST op4_AST_in = null;
+                               op4_AST = astFactory.create(op4);
+                               astFactory.addASTChild(currentAST, op4_AST);
+                               ASTPair __currentAST9886 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MENOR_IGUAL);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9886;
+                               _t = __t9886;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Rel( e1, e2, op4);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case IGUAL:
+                       {
+                               AST __t9887 = _t;
+                               op5 = _t==ASTNULL ? null :(AST)_t;
+                               AST op5_AST_in = null;
+                               op5_AST = astFactory.create(op5);
+                               astFactory.addASTChild(currentAST, op5_AST);
+                               ASTPair __currentAST9887 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,IGUAL);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9887;
+                               _t = __t9887;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Rel( e1, e2, op5);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case DISTINTO:
+                       {
+                               AST __t9888 = _t;
+                               op6 = _t==ASTNULL ? null :(AST)_t;
+                               AST op6_AST_in = null;
+                               op6_AST = astFactory.create(op6);
+                               astFactory.addASTChild(currentAST, op6_AST);
+                               ASTPair __currentAST9888 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,DISTINTO);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9888;
+                               _t = __t9888;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Rel( e1, e2, op6);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MAS:
+                       {
+                               AST __t9889 = _t;
+                               AST tmp34_AST = null;
+                               AST tmp34_AST_in = null;
+                               tmp34_AST = astFactory.create((AST)_t);
+                               tmp34_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp34_AST);
+                               ASTPair __currentAST9889 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MAS);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9889;
+                               _t = __t9889;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Arit( e1, e2);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MENOS:
+                       {
+                               AST __t9890 = _t;
+                               AST tmp35_AST = null;
+                               AST tmp35_AST_in = null;
+                               tmp35_AST = astFactory.create((AST)_t);
+                               tmp35_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp35_AST);
+                               ASTPair __currentAST9890 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MENOS);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9890;
+                               _t = __t9890;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Arit( e1, e2);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MENOSUNARIO:
+                       {
+                               AST __t9891 = _t;
+                               AST tmp36_AST = null;
+                               AST tmp36_AST_in = null;
+                               tmp36_AST = astFactory.create((AST)_t);
+                               tmp36_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp36_AST);
+                               ASTPair __currentAST9891 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MENOSUNARIO);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9891;
+                               _t = __t9891;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Una_Arit( e1);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case POR:
+                       {
+                               AST __t9892 = _t;
+                               AST tmp37_AST = null;
+                               AST tmp37_AST_in = null;
+                               tmp37_AST = astFactory.create((AST)_t);
+                               tmp37_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp37_AST);
+                               ASTPair __currentAST9892 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,POR);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9892;
+                               _t = __t9892;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Arit( e1, e2);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case DIVISION:
+                       {
+                               AST __t9893 = _t;
+                               AST tmp38_AST = null;
+                               AST tmp38_AST_in = null;
+                               tmp38_AST = astFactory.create((AST)_t);
+                               tmp38_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp38_AST);
+                               ASTPair __currentAST9893 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,DIVISION);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               e2=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9893;
+                               _t = __t9893;
+                               _t = _t.getNextSibling();
+                               res=AS_Exp_Bin_Arit( e1, e2);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case LLAMADA:
+                       {
+                               AST __t9894 = _t;
+                               AST tmp39_AST = null;
+                               AST tmp39_AST_in = null;
+                               tmp39_AST = astFactory.create((AST)_t);
+                               tmp39_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp39_AST);
+                               ASTPair __currentAST9894 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,LLAMADA);
+                               _t = _t.getFirstChild();
+                               e1=acceso(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               AST __t9895 = _t;
+                               AST tmp40_AST = null;
+                               AST tmp40_AST_in = null;
+                               tmp40_AST = astFactory.create((AST)_t);
+                               tmp40_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp40_AST);
+                               ASTPair __currentAST9895 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,EXPRESIONES);
+                               _t = _t.getFirstChild();
+                               l=lista_expresiones(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9895;
+                               _t = __t9895;
+                               _t = _t.getNextSibling();
+                               currentAST = __currentAST9894;
+                               _t = __t9894;
+                               _t = _t.getNextSibling();
+                               res=AS_Llamada( e1, l);
+                               if (res != null){
+                                       if (res.getTipo().getType() == VACIO){
+                                               System.out.println("ERROR: No se puede recoger el valor devuelto por un procedimiento (no devuelve nada).");
+                                               System.exit(1);
+                                       }
+                               }
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ACCESO_TABLA:
+                       {
+                               AST __t9896 = _t;
+                               AST tmp41_AST = null;
+                               AST tmp41_AST_in = null;
+                               tmp41_AST = astFactory.create((AST)_t);
+                               tmp41_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp41_AST);
+                               ASTPair __currentAST9896 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,ACCESO_TABLA);
+                               _t = _t.getFirstChild();
+                               e1=acceso(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               AST __t9897 = _t;
+                               AST tmp42_AST = null;
+                               AST tmp42_AST_in = null;
+                               tmp42_AST = astFactory.create((AST)_t);
+                               tmp42_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp42_AST);
+                               ASTPair __currentAST9897 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,EXPRESIONES);
+                               _t = _t.getFirstChild();
+                               l=lista_expresiones_nv(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9897;
+                               _t = __t9897;
+                               _t = _t.getNextSibling();
+                               currentAST = __currentAST9896;
+                               _t = __t9896;
+                               _t = _t.getNextSibling();
+                               res=AS_Acceso_Tabla( e1, l);
+                               
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ACCESO_OBJETO:
+                       case ACCESO_SIMPLE:
+                       {
+                               e1=acceso(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               res=e1;
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case LIT_ENTERO:
+                       {
+                               i = (AST)_t;
+                               AST i_AST_in = null;
+                               i_AST = astFactory.create(i);
+                               astFactory.addASTChild(currentAST, i_AST);
+                               match(_t,LIT_ENTERO);
+                               _t = _t.getNextSibling();
+                               res=AS_Literal( i);
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case LIT_REAL:
+                       {
+                               j = (AST)_t;
+                               AST j_AST_in = null;
+                               j_AST = astFactory.create(j);
+                               astFactory.addASTChild(currentAST, j_AST);
+                               match(_t,LIT_REAL);
+                               _t = _t.getNextSibling();
+                               res=AS_Literal( j);
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case LIT_CAR:
+                       {
+                               k = (AST)_t;
+                               AST k_AST_in = null;
+                               k_AST = astFactory.create(k);
+                               astFactory.addASTChild(currentAST, k_AST);
+                               match(_t,LIT_CAR);
+                               _t = _t.getNextSibling();
+                               res=AS_Literal( k);
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case CIERTO:
+                       {
+                               m = (AST)_t;
+                               AST m_AST_in = null;
+                               m_AST = astFactory.create(m);
+                               astFactory.addASTChild(currentAST, m_AST);
+                               match(_t,CIERTO);
+                               _t = _t.getNextSibling();
+                               res=AS_Literal( m);
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case FALSO:
+                       {
+                               n = (AST)_t;
+                               AST n_AST_in = null;
+                               n_AST = astFactory.create(n);
+                               astFactory.addASTChild(currentAST, n_AST);
+                               match(_t,FALSO);
+                               _t = _t.getNextSibling();
+                               res=AS_Literal( n);
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ENTERO_A_REAL:
+                       {
+                               AST __t9898 = _t;
+                               AST tmp43_AST = null;
+                               AST tmp43_AST_in = null;
+                               tmp43_AST = astFactory.create((AST)_t);
+                               tmp43_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp43_AST);
+                               ASTPair __currentAST9898 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,ENTERO_A_REAL);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9898;
+                               _t = __t9898;
+                               _t = _t.getNextSibling();
+                               res = AS_Entero_A_Real(e1);
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case REAL_A_ENTERO:
+                       {
+                               AST __t9899 = _t;
+                               AST tmp44_AST = null;
+                               AST tmp44_AST_in = null;
+                               tmp44_AST = astFactory.create((AST)_t);
+                               tmp44_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp44_AST);
+                               ASTPair __currentAST9899 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,REAL_A_ENTERO);
+                               _t = _t.getFirstChild();
+                               e1=expresion(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9899;
+                               _t = __t9899;
+                               _t = _t.getNextSibling();
+                               res = AS_Real_A_Entero(e1);
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ERROR:
+                       {
+                               AST tmp45_AST = null;
+                               AST tmp45_AST_in = null;
+                               tmp45_AST = astFactory.create((AST)_t);
+                               tmp45_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp45_AST);
+                               match(_t,ERROR);
+                               _t = _t.getNextSibling();
+                               expresion_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = expresion_AST;
+               _retTree = _t;
+               return res;
+       }
+       
+       public final void condicion(AST _t,
+               AST tipodev
+       ) throws RecognitionException {
+               
+               AST condicion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST condicion_AST = null;
+               Atr_Expr e;
+               
+               try {      // for error handling
+                       AST __t9872 = _t;
+                       AST tmp46_AST = null;
+                       AST tmp46_AST_in = null;
+                       tmp46_AST = astFactory.create((AST)_t);
+                       tmp46_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp46_AST);
+                       ASTPair __currentAST9872 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,SI);
+                       _t = _t.getFirstChild();
+                       e=expresion(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       AST __t9873 = _t;
+                       AST tmp47_AST = null;
+                       AST tmp47_AST_in = null;
+                       tmp47_AST = astFactory.create((AST)_t);
+                       tmp47_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp47_AST);
+                       ASTPair __currentAST9873 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,INSTRUCCIONES);
+                       _t = _t.getFirstChild();
+                       instrucciones(_t,tipodev);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9873;
+                       _t = __t9873;
+                       _t = _t.getNextSibling();
+                       {
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case INSTRUCCIONES:
+                       {
+                               AST __t9875 = _t;
+                               AST tmp48_AST = null;
+                               AST tmp48_AST_in = null;
+                               tmp48_AST = astFactory.create((AST)_t);
+                               tmp48_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp48_AST);
+                               ASTPair __currentAST9875 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,INSTRUCCIONES);
+                               _t = _t.getFirstChild();
+                               instrucciones(_t,tipodev);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9875;
+                               _t = __t9875;
+                               _t = _t.getNextSibling();
+                               break;
+                       }
+                       case 3:
+                       {
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+                       }
+                       currentAST = __currentAST9872;
+                       _t = __t9872;
+                       _t = _t.getNextSibling();
+                       AS_Condicional(e);
+                       
+                       condicion_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = condicion_AST;
+               _retTree = _t;
+       }
+       
+       public final void iteracion(AST _t,
+               AST tipodev
+       ) throws RecognitionException {
+               
+               AST iteracion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST iteracion_AST = null;
+               Atr_Expr e;
+               
+               try {      // for error handling
+                       AST __t9877 = _t;
+                       AST tmp49_AST = null;
+                       AST tmp49_AST_in = null;
+                       tmp49_AST = astFactory.create((AST)_t);
+                       tmp49_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp49_AST);
+                       ASTPair __currentAST9877 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,MIENTRAS);
+                       _t = _t.getFirstChild();
+                       e=expresion(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       AST __t9878 = _t;
+                       AST tmp50_AST = null;
+                       AST tmp50_AST_in = null;
+                       tmp50_AST = astFactory.create((AST)_t);
+                       tmp50_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp50_AST);
+                       ASTPair __currentAST9878 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,INSTRUCCIONES);
+                       _t = _t.getFirstChild();
+                       instrucciones(_t,tipodev);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9878;
+                       _t = __t9878;
+                       _t = _t.getNextSibling();
+                       currentAST = __currentAST9877;
+                       _t = __t9877;
+                       _t = _t.getNextSibling();
+                       AS_Condicional(e);
+                       
+                       iteracion_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = iteracion_AST;
+               _retTree = _t;
+       }
+       
+       public final Atr_Expr  acceso(AST _t) throws RecognitionException {
+               Atr_Expr res=null;
+               
+               AST acceso_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST acceso_AST = null;
+               AST r_AST = null;
+               AST r = null;
+               AST a = null;
+               AST a_AST = null;
+               Atr_Expr e;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case ACCESO_SIMPLE:
+                       {
+                               e=acceso_simple(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               res=e;
+                               acceso_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ACCESO_OBJETO:
+                       {
+                               AST __t9901 = _t;
+                               AST tmp51_AST = null;
+                               AST tmp51_AST_in = null;
+                               tmp51_AST = astFactory.create((AST)_t);
+                               tmp51_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp51_AST);
+                               ASTPair __currentAST9901 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,ACCESO_OBJETO);
+                               _t = _t.getFirstChild();
+                               r = _t==ASTNULL ? null : (AST)_t;
+                               e=acceso_simple(_t);
+                               _t = _retTree;
+                               r_AST = (AST)returnAST;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               a = (AST)_t;
+                               AST a_AST_in = null;
+                               a_AST = astFactory.create(a);
+                               astFactory.addASTChild(currentAST, a_AST);
+                               match(_t,IDENT);
+                               _t = _t.getNextSibling();
+                               currentAST = __currentAST9901;
+                               _t = __t9901;
+                               _t = _t.getNextSibling();
+                               
+                                       res=AS_Acceso_Objeto( e, r, a);
+                               
+                               acceso_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = acceso_AST;
+               _retTree = _t;
+               return res;
+       }
+       
+       public final LinkedList  lista_expresiones(AST _t) throws RecognitionException {
+               LinkedList l= new LinkedList();
+               
+               AST lista_expresiones_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST lista_expresiones_AST = null;
+               Atr_Expr e;
+               
+               try {      // for error handling
+                       {
+                       _loop9870:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_tokenSet_0.member(_t.getType()))) {
+                                       e=expresion(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                                       l.add(e);
+                               }
+                               else {
+                                       break _loop9870;
+                               }
+                               
+                       } while (true);
+                       }
+                       lista_expresiones_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = lista_expresiones_AST;
+               _retTree = _t;
+               return l;
+       }
+       
+       public final LinkedList  lista_expresiones_nv(AST _t) throws RecognitionException {
+               LinkedList l= new LinkedList();
+               
+               AST lista_expresiones_nv_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST lista_expresiones_nv_AST = null;
+               Atr_Expr e;
+               
+               try {      // for error handling
+                       {
+                       int _cnt9907=0;
+                       _loop9907:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_tokenSet_0.member(_t.getType()))) {
+                                       e=expresion(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                                       l.add(e);
+                               }
+                               else {
+                                       if ( _cnt9907>=1 ) { break _loop9907; } else {throw new NoViableAltException(_t);}
+                               }
+                               
+                               _cnt9907++;
+                       } while (true);
+                       }
+                       lista_expresiones_nv_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = lista_expresiones_nv_AST;
+               _retTree = _t;
+               return l;
+       }
+       
+       public final Atr_Expr  acceso_simple(AST _t) throws RecognitionException {
+               Atr_Expr res=null;
+               
+               AST acceso_simple_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST acceso_simple_AST = null;
+               AST d_AST = null;
+               AST d = null;
+               
+               try {      // for error handling
+                       AST __t9903 = _t;
+                       AST tmp52_AST = null;
+                       AST tmp52_AST_in = null;
+                       tmp52_AST = astFactory.create((AST)_t);
+                       tmp52_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp52_AST);
+                       ASTPair __currentAST9903 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,ACCESO_SIMPLE);
+                       _t = _t.getFirstChild();
+                       AST tmp53_AST = null;
+                       AST tmp53_AST_in = null;
+                       tmp53_AST = astFactory.create((AST)_t);
+                       tmp53_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp53_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       d = _t==ASTNULL ? null : (AST)_t;
+                       declaracion_acceso(_t);
+                       _t = _retTree;
+                       d_AST = (AST)returnAST;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9903;
+                       _t = __t9903;
+                       _t = _t.getNextSibling();
+                       res=AS_Acceso_Simple(d_AST);
+                       acceso_simple_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = acceso_simple_AST;
+               _retTree = _t;
+               return res;
+       }
+       
+       public final void declaracion_acceso(AST _t) throws RecognitionException {
+               
+               AST declaracion_acceso_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_acceso_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case MODULO:
+                       {
+                               declaracion_modulo(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               declaracion_acceso_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case CLASE:
+                       {
+                               declaracion_clase1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               declaracion_acceso_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ATRIBUTO:
+                       case METODO:
+                       {
+                               declaracion_elemento_clase1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               declaracion_acceso_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case PARAMETRO:
+                       {
+                               declaracion_parametro1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               declaracion_acceso_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case VARIABLE_LOCAL:
+                       {
+                               declaracion_variable_local1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               declaracion_acceso_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ERROR:
+                       {
+                               declaracion_error(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               declaracion_acceso_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_acceso_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_clase1(AST _t) throws RecognitionException {
+               
+               AST declaracion_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_clase1_AST = null;
+               AST n_AST = null;
+               AST n = null;
+               
+               try {      // for error handling
+                       AST __t9919 = _t;
+                       AST tmp54_AST = null;
+                       AST tmp54_AST_in = null;
+                       tmp54_AST = astFactory.create((AST)_t);
+                       tmp54_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp54_AST);
+                       ASTPair __currentAST9919 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,CLASE);
+                       _t = _t.getFirstChild();
+                       n = _t==ASTNULL ? null : (AST)_t;
+                       nombre_clase1(_t);
+                       _t = _retTree;
+                       n_AST = (AST)returnAST;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       cualificador_clase1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       definicion_clase1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9919;
+                       _t = __t9919;
+                       _t = _t.getNextSibling();
+                       declaracion_clase1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_clase1_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_elemento_clase1(AST _t) throws RecognitionException {
+               
+               AST declaracion_elemento_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_elemento_clase1_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case METODO:
+                       {
+                               AST __t9927 = _t;
+                               AST tmp55_AST = null;
+                               AST tmp55_AST_in = null;
+                               tmp55_AST = astFactory.create((AST)_t);
+                               tmp55_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp55_AST);
+                               ASTPair __currentAST9927 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,METODO);
+                               _t = _t.getFirstChild();
+                               declaracion_metodo1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               cualificador_elemento_clase1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9927;
+                               _t = __t9927;
+                               _t = _t.getNextSibling();
+                               declaracion_elemento_clase1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ATRIBUTO:
+                       {
+                               AST __t9928 = _t;
+                               AST tmp56_AST = null;
+                               AST tmp56_AST_in = null;
+                               tmp56_AST = astFactory.create((AST)_t);
+                               tmp56_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp56_AST);
+                               ASTPair __currentAST9928 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,ATRIBUTO);
+                               _t = _t.getFirstChild();
+                               AST tmp57_AST = null;
+                               AST tmp57_AST_in = null;
+                               tmp57_AST = astFactory.create((AST)_t);
+                               tmp57_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp57_AST);
+                               match(_t,IDENT);
+                               _t = _t.getNextSibling();
+                               tipo1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               cualificador_elemento_clase1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9928;
+                               _t = __t9928;
+                               _t = _t.getNextSibling();
+                               declaracion_elemento_clase1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_elemento_clase1_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_parametro1(AST _t) throws RecognitionException {
+               
+               AST declaracion_parametro1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_parametro1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9940 = _t;
+                       AST tmp58_AST = null;
+                       AST tmp58_AST_in = null;
+                       tmp58_AST = astFactory.create((AST)_t);
+                       tmp58_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp58_AST);
+                       ASTPair __currentAST9940 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,PARAMETRO);
+                       _t = _t.getFirstChild();
+                       AST tmp59_AST = null;
+                       AST tmp59_AST_in = null;
+                       tmp59_AST = astFactory.create((AST)_t);
+                       tmp59_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp59_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       tipo1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9940;
+                       _t = __t9940;
+                       _t = _t.getNextSibling();
+                       declaracion_parametro1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_parametro1_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_variable_local1(AST _t) throws RecognitionException {
+               
+               AST declaracion_variable_local1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_variable_local1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9949 = _t;
+                       AST tmp60_AST = null;
+                       AST tmp60_AST_in = null;
+                       tmp60_AST = astFactory.create((AST)_t);
+                       tmp60_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp60_AST);
+                       ASTPair __currentAST9949 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,VARIABLE_LOCAL);
+                       _t = _t.getFirstChild();
+                       AST tmp61_AST = null;
+                       AST tmp61_AST_in = null;
+                       tmp61_AST = astFactory.create((AST)_t);
+                       tmp61_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp61_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       tipo1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9949;
+                       _t = __t9949;
+                       _t = _t.getNextSibling();
+                       declaracion_variable_local1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_variable_local1_AST;
+               _retTree = _t;
+       }
+       
+       public final void tipo_predefinido_simple(AST _t) throws RecognitionException {
+               
+               AST tipo_predefinido_simple_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST tipo_predefinido_simple_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case ENTERO:
+                       {
+                               AST tmp62_AST = null;
+                               AST tmp62_AST_in = null;
+                               tmp62_AST = astFactory.create((AST)_t);
+                               tmp62_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp62_AST);
+                               match(_t,ENTERO);
+                               _t = _t.getNextSibling();
+                               tipo_predefinido_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case REAL:
+                       {
+                               AST tmp63_AST = null;
+                               AST tmp63_AST_in = null;
+                               tmp63_AST = astFactory.create((AST)_t);
+                               tmp63_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp63_AST);
+                               match(_t,REAL);
+                               _t = _t.getNextSibling();
+                               tipo_predefinido_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case LOGICO:
+                       {
+                               AST tmp64_AST = null;
+                               AST tmp64_AST_in = null;
+                               tmp64_AST = astFactory.create((AST)_t);
+                               tmp64_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp64_AST);
+                               match(_t,LOGICO);
+                               _t = _t.getNextSibling();
+                               tipo_predefinido_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case CARACTER:
+                       {
+                               AST tmp65_AST = null;
+                               AST tmp65_AST_in = null;
+                               tmp65_AST = astFactory.create((AST)_t);
+                               tmp65_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp65_AST);
+                               match(_t,CARACTER);
+                               _t = _t.getNextSibling();
+                               tipo_predefinido_simple_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = tipo_predefinido_simple_AST;
+               _retTree = _t;
+       }
+       
+       public final void tipo_predefinido_compuesto(AST _t) throws RecognitionException {
+               
+               AST tipo_predefinido_compuesto_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST tipo_predefinido_compuesto_AST = null;
+               
+               try {      // for error handling
+                       formacion(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       tipo_predefinido_compuesto_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = tipo_predefinido_compuesto_AST;
+               _retTree = _t;
+       }
+       
+       public final void formacion(AST _t) throws RecognitionException {
+               
+               AST formacion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST formacion_AST = null;
+               AST t=null;
+               
+               try {      // for error handling
+                       AST __t9912 = _t;
+                       AST tmp66_AST = null;
+                       AST tmp66_AST_in = null;
+                       tmp66_AST = astFactory.create((AST)_t);
+                       tmp66_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp66_AST);
+                       ASTPair __currentAST9912 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,FORMACION);
+                       _t = _t.getFirstChild();
+                       AST __t9913 = _t;
+                       AST tmp67_AST = null;
+                       AST tmp67_AST_in = null;
+                       tmp67_AST = astFactory.create((AST)_t);
+                       tmp67_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp67_AST);
+                       ASTPair __currentAST9913 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,LISTA_ENTEROS);
+                       _t = _t.getFirstChild();
+                       lista_enteros(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9913;
+                       _t = __t9913;
+                       _t = _t.getNextSibling();
+                       {
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case ENTERO:
+                       case REAL:
+                       case LOGICO:
+                       case CARACTER:
+                       {
+                               tipo_predefinido_simple(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               break;
+                       }
+                       case CLASE:
+                       {
+                               declaracion_clase1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+                       }
+                       currentAST = __currentAST9912;
+                       _t = __t9912;
+                       _t = _t.getNextSibling();
+                       formacion_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = formacion_AST;
+               _retTree = _t;
+       }
+       
+       public final void lista_enteros(AST _t) throws RecognitionException {
+               
+               AST lista_enteros_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST lista_enteros_AST = null;
+               
+               try {      // for error handling
+                       {
+                       int _cnt9917=0;
+                       _loop9917:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==LIT_ENTERO)) {
+                                       AST tmp68_AST = null;
+                                       AST tmp68_AST_in = null;
+                                       tmp68_AST = astFactory.create((AST)_t);
+                                       tmp68_AST_in = (AST)_t;
+                                       astFactory.addASTChild(currentAST, tmp68_AST);
+                                       match(_t,LIT_ENTERO);
+                                       _t = _t.getNextSibling();
+                               }
+                               else {
+                                       if ( _cnt9917>=1 ) { break _loop9917; } else {throw new NoViableAltException(_t);}
+                               }
+                               
+                               _cnt9917++;
+                       } while (true);
+                       }
+                       lista_enteros_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = lista_enteros_AST;
+               _retTree = _t;
+       }
+       
+       public final void nombre_clase1(AST _t) throws RecognitionException {
+               
+               AST nombre_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST nombre_clase1_AST = null;
+               
+               try {      // for error handling
+                       AST tmp69_AST = null;
+                       AST tmp69_AST_in = null;
+                       tmp69_AST = astFactory.create((AST)_t);
+                       tmp69_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp69_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       nombre_clase1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = nombre_clase1_AST;
+               _retTree = _t;
+       }
+       
+       public final void cualificador_clase1(AST _t) throws RecognitionException {
+               
+               AST cualificador_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST cualificador_clase1_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case INST:
+                       {
+                               AST tmp70_AST = null;
+                               AST tmp70_AST_in = null;
+                               tmp70_AST = astFactory.create((AST)_t);
+                               tmp70_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp70_AST);
+                               match(_t,INST);
+                               _t = _t.getNextSibling();
+                               cualificador_clase1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case NO_INST:
+                       {
+                               AST tmp71_AST = null;
+                               AST tmp71_AST_in = null;
+                               tmp71_AST = astFactory.create((AST)_t);
+                               tmp71_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp71_AST);
+                               match(_t,NO_INST);
+                               _t = _t.getNextSibling();
+                               cualificador_clase1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = cualificador_clase1_AST;
+               _retTree = _t;
+       }
+       
+       public final void definicion_clase1(AST _t) throws RecognitionException {
+               
+               AST definicion_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST definicion_clase1_AST = null;
+               
+               try {      // for error handling
+                       declaraciones_elementos_clase1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       definicion_clase1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = definicion_clase1_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaraciones_elementos_clase1(AST _t) throws RecognitionException {
+               
+               AST declaraciones_elementos_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaraciones_elementos_clase1_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9925:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==ATRIBUTO||_t.getType()==METODO)) {
+                                       declaracion_elemento_clase1(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9925;
+                               }
+                               
+                       } while (true);
+                       }
+                       declaraciones_elementos_clase1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaraciones_elementos_clase1_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_metodo1(AST _t) throws RecognitionException {
+               
+               AST declaracion_metodo1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_metodo1_AST = null;
+               
+               try {      // for error handling
+                       prototipo_metodo1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       definicion_metodo1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       declaracion_metodo1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_metodo1_AST;
+               _retTree = _t;
+       }
+       
+       public final void cualificador_elemento_clase1(AST _t) throws RecognitionException {
+               
+               AST cualificador_elemento_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST cualificador_elemento_clase1_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case OCULTO:
+                       {
+                               AST tmp72_AST = null;
+                               AST tmp72_AST_in = null;
+                               tmp72_AST = astFactory.create((AST)_t);
+                               tmp72_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp72_AST);
+                               match(_t,OCULTO);
+                               _t = _t.getNextSibling();
+                               cualificador_elemento_clase1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case VISIBLE:
+                       {
+                               AST tmp73_AST = null;
+                               AST tmp73_AST_in = null;
+                               tmp73_AST = astFactory.create((AST)_t);
+                               tmp73_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp73_AST);
+                               match(_t,VISIBLE);
+                               _t = _t.getNextSibling();
+                               cualificador_elemento_clase1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = cualificador_elemento_clase1_AST;
+               _retTree = _t;
+       }
+       
+       public final void tipo1(AST _t) throws RecognitionException {
+               
+               AST tipo1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST tipo1_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case ENTERO:
+                       case REAL:
+                       case LOGICO:
+                       case CARACTER:
+                       {
+                               tipo_predefinido_simple1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               tipo1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case FORMACION:
+                       {
+                               tipo_predefinido_compuesto1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               tipo1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case CLASE:
+                       {
+                               declaracion_clase1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               tipo1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ERROR:
+                       {
+                               declaracion_error1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               tipo1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = tipo1_AST;
+               _retTree = _t;
+       }
+       
+       public final void prototipo_metodo1(AST _t) throws RecognitionException {
+               
+               AST prototipo_metodo1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST prototipo_metodo1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9932 = _t;
+                       AST tmp74_AST = null;
+                       AST tmp74_AST_in = null;
+                       tmp74_AST = astFactory.create((AST)_t);
+                       tmp74_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp74_AST);
+                       ASTPair __currentAST9932 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,PROTOTIPO);
+                       _t = _t.getFirstChild();
+                       AST tmp75_AST = null;
+                       AST tmp75_AST_in = null;
+                       tmp75_AST = astFactory.create((AST)_t);
+                       tmp75_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp75_AST);
+                       match(_t,IDENT);
+                       _t = _t.getNextSibling();
+                       AST __t9933 = _t;
+                       AST tmp76_AST = null;
+                       AST tmp76_AST_in = null;
+                       tmp76_AST = astFactory.create((AST)_t);
+                       tmp76_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp76_AST);
+                       ASTPair __currentAST9933 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,PARAMETROS);
+                       _t = _t.getFirstChild();
+                       declaracion_parametros1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9933;
+                       _t = __t9933;
+                       _t = _t.getNextSibling();
+                       AST __t9934 = _t;
+                       AST tmp77_AST = null;
+                       AST tmp77_AST_in = null;
+                       tmp77_AST = astFactory.create((AST)_t);
+                       tmp77_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp77_AST);
+                       ASTPair __currentAST9934 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,RESULTADO);
+                       _t = _t.getFirstChild();
+                       {
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case ERROR:
+                       case CLASE:
+                       case ENTERO:
+                       case REAL:
+                       case LOGICO:
+                       case CARACTER:
+                       case FORMACION:
+                       {
+                               tipo1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               break;
+                       }
+                       case VACIO:
+                       {
+                               AST tmp78_AST = null;
+                               AST tmp78_AST_in = null;
+                               tmp78_AST = astFactory.create((AST)_t);
+                               tmp78_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp78_AST);
+                               match(_t,VACIO);
+                               _t = _t.getNextSibling();
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+                       }
+                       currentAST = __currentAST9934;
+                       _t = __t9934;
+                       _t = _t.getNextSibling();
+                       currentAST = __currentAST9932;
+                       _t = __t9932;
+                       _t = _t.getNextSibling();
+                       prototipo_metodo1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = prototipo_metodo1_AST;
+               _retTree = _t;
+       }
+       
+       public final void definicion_metodo1(AST _t) throws RecognitionException {
+               
+               AST definicion_metodo1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST definicion_metodo1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9942 = _t;
+                       AST tmp79_AST = null;
+                       AST tmp79_AST_in = null;
+                       tmp79_AST = astFactory.create((AST)_t);
+                       tmp79_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp79_AST);
+                       ASTPair __currentAST9942 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,DEFINICION);
+                       _t = _t.getFirstChild();
+                       AST __t9943 = _t;
+                       AST tmp80_AST = null;
+                       AST tmp80_AST_in = null;
+                       tmp80_AST = astFactory.create((AST)_t);
+                       tmp80_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp80_AST);
+                       ASTPair __currentAST9943 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,VARIABLES_LOCALES);
+                       _t = _t.getFirstChild();
+                       declaracion_variables_locales1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9943;
+                       _t = __t9943;
+                       _t = _t.getNextSibling();
+                       AST __t9944 = _t;
+                       AST tmp81_AST = null;
+                       AST tmp81_AST_in = null;
+                       tmp81_AST = astFactory.create((AST)_t);
+                       tmp81_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp81_AST);
+                       ASTPair __currentAST9944 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,INSTRUCCIONES);
+                       _t = _t.getFirstChild();
+                       instrucciones1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9944;
+                       _t = __t9944;
+                       _t = _t.getNextSibling();
+                       currentAST = __currentAST9942;
+                       _t = __t9942;
+                       _t = _t.getNextSibling();
+                       definicion_metodo1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = definicion_metodo1_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_parametros1(AST _t) throws RecognitionException {
+               
+               AST declaracion_parametros1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_parametros1_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9938:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==PARAMETRO)) {
+                                       declaracion_parametro1(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9938;
+                               }
+                               
+                       } while (true);
+                       }
+                       declaracion_parametros1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_parametros1_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_variables_locales1(AST _t) throws RecognitionException {
+               
+               AST declaracion_variables_locales1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_variables_locales1_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9947:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==VARIABLE_LOCAL)) {
+                                       declaracion_variable_local1(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9947;
+                               }
+                               
+                       } while (true);
+                       }
+                       declaracion_variables_locales1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_variables_locales1_AST;
+               _retTree = _t;
+       }
+       
+       public final void instrucciones1(AST _t) throws RecognitionException {
+               
+               AST instrucciones1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST instrucciones1_AST = null;
+               
+               try {      // for error handling
+                       {
+                       _loop9953:
+                       do {
+                               if (_t==null) _t=ASTNULL;
+                               if ((_t.getType()==INSTRUCCION)) {
+                                       instruccion1(_t);
+                                       _t = _retTree;
+                                       astFactory.addASTChild(currentAST, returnAST);
+                               }
+                               else {
+                                       break _loop9953;
+                               }
+                               
+                       } while (true);
+                       }
+                       instrucciones1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = instrucciones1_AST;
+               _retTree = _t;
+       }
+       
+       public final void declaracion_error1(AST _t) throws RecognitionException {
+               
+               AST declaracion_error1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST declaracion_error1_AST = null;
+               
+               try {      // for error handling
+                       AST tmp82_AST = null;
+                       AST tmp82_AST_in = null;
+                       tmp82_AST = astFactory.create((AST)_t);
+                       tmp82_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp82_AST);
+                       match(_t,ERROR);
+                       _t = _t.getNextSibling();
+                       declaracion_error1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = declaracion_error1_AST;
+               _retTree = _t;
+       }
+       
+       public final void instruccion1(AST _t) throws RecognitionException {
+               
+               AST instruccion1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST instruccion1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9955 = _t;
+                       AST tmp83_AST = null;
+                       AST tmp83_AST_in = null;
+                       tmp83_AST = astFactory.create((AST)_t);
+                       tmp83_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp83_AST);
+                       ASTPair __currentAST9955 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,INSTRUCCION);
+                       _t = _t.getFirstChild();
+                       {
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case LLAMADA:
+                       case DEV:
+                       case ASIGNACION:
+                       case CREAR:
+                       case ESCRIBIR:
+                       {
+                               instruccion_simple1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               break;
+                       }
+                       case SI:
+                       case MIENTRAS:
+                       {
+                               instruccion_compuesta1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+                       }
+                       currentAST = __currentAST9955;
+                       _t = __t9955;
+                       _t = _t.getNextSibling();
+                       instruccion1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = instruccion1_AST;
+               _retTree = _t;
+       }
+       
+       public final void instruccion_simple1(AST _t) throws RecognitionException {
+               
+               AST instruccion_simple1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST instruccion_simple1_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case CREAR:
+                       {
+                               crear1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case LLAMADA:
+                       {
+                               llamada_metodo1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ESCRIBIR:
+                       {
+                               escribir1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case ASIGNACION:
+                       {
+                               asignacion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case DEV:
+                       {
+                               retorno1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_simple1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = instruccion_simple1_AST;
+               _retTree = _t;
+       }
+       
+       public final void instruccion_compuesta1(AST _t) throws RecognitionException {
+               
+               AST instruccion_compuesta1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST instruccion_compuesta1_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case SI:
+                       {
+                               condicion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_compuesta1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MIENTRAS:
+                       {
+                               iteracion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               instruccion_compuesta1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       default:
+                       {
+                               throw new NoViableAltException(_t);
+                       }
+                       }
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = instruccion_compuesta1_AST;
+               _retTree = _t;
+       }
+       
+       public final void crear1(AST _t) throws RecognitionException {
+               
+               AST crear1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST crear1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9959 = _t;
+                       AST tmp84_AST = null;
+                       AST tmp84_AST_in = null;
+                       tmp84_AST = astFactory.create((AST)_t);
+                       tmp84_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp84_AST);
+                       ASTPair __currentAST9959 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,CREAR);
+                       _t = _t.getFirstChild();
+                       expresion1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       expresion1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9959;
+                       _t = __t9959;
+                       _t = _t.getNextSibling();
+                       crear1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = crear1_AST;
+               _retTree = _t;
+       }
+       
+       public final void llamada_metodo1(AST _t) throws RecognitionException {
+               
+               AST llamada_metodo1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST llamada_metodo1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9968 = _t;
+                       AST tmp85_AST = null;
+                       AST tmp85_AST_in = null;
+                       tmp85_AST = astFactory.create((AST)_t);
+                       tmp85_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp85_AST);
+                       ASTPair __currentAST9968 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,LLAMADA);
+                       _t = _t.getFirstChild();
+                       acceso1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       AST __t9969 = _t;
+                       AST tmp86_AST = null;
+                       AST tmp86_AST_in = null;
+                       tmp86_AST = astFactory.create((AST)_t);
+                       tmp86_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp86_AST);
+                       ASTPair __currentAST9969 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,EXPRESIONES);
+                       _t = _t.getFirstChild();
+                       lista_expresiones1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9969;
+                       _t = __t9969;
+                       _t = _t.getNextSibling();
+                       currentAST = __currentAST9968;
+                       _t = __t9968;
+                       _t = _t.getNextSibling();
+                       llamada_metodo1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = llamada_metodo1_AST;
+               _retTree = _t;
+       }
+       
+       public final void escribir1(AST _t) throws RecognitionException {
+               
+               AST escribir1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST escribir1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9961 = _t;
+                       AST tmp87_AST = null;
+                       AST tmp87_AST_in = null;
+                       tmp87_AST = astFactory.create((AST)_t);
+                       tmp87_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp87_AST);
+                       ASTPair __currentAST9961 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,ESCRIBIR);
+                       _t = _t.getFirstChild();
+                       expresion1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9961;
+                       _t = __t9961;
+                       _t = _t.getNextSibling();
+                       escribir1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = escribir1_AST;
+               _retTree = _t;
+       }
+       
+       public final void asignacion1(AST _t) throws RecognitionException {
+               
+               AST asignacion1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST asignacion1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9964 = _t;
+                       AST tmp88_AST = null;
+                       AST tmp88_AST_in = null;
+                       tmp88_AST = astFactory.create((AST)_t);
+                       tmp88_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp88_AST);
+                       ASTPair __currentAST9964 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,ASIGNACION);
+                       _t = _t.getFirstChild();
+                       expresion1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       expresion1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9964;
+                       _t = __t9964;
+                       _t = _t.getNextSibling();
+                       asignacion1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = asignacion1_AST;
+               _retTree = _t;
+       }
+       
+       public final void retorno1(AST _t) throws RecognitionException {
+               
+               AST retorno1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST retorno1_AST = null;
+               
+               try {      // for error handling
+                       AST __t9966 = _t;
+                       AST tmp89_AST = null;
+                       AST tmp89_AST_in = null;
+                       tmp89_AST = astFactory.create((AST)_t);
+                       tmp89_AST_in = (AST)_t;
+                       astFactory.addASTChild(currentAST, tmp89_AST);
+                       ASTPair __currentAST9966 = currentAST.copy();
+                       currentAST.root = currentAST.child;
+                       currentAST.child = null;
+                       match(_t,DEV);
+                       _t = _t.getFirstChild();
+                       expresion1(_t);
+                       _t = _retTree;
+                       astFactory.addASTChild(currentAST, returnAST);
+                       currentAST = __currentAST9966;
+                       _t = __t9966;
+                       _t = _t.getNextSibling();
+                       retorno1_AST = (AST)currentAST.root;
+               }
+               catch (RecognitionException ex) {
+                       reportError(ex);
+                       if (_t!=null) {_t = _t.getNextSibling();}
+               }
+               returnAST = retorno1_AST;
+               _retTree = _t;
+       }
+       
+       public final void expresion1(AST _t) throws RecognitionException {
+               
+               AST expresion1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
+               returnAST = null;
+               ASTPair currentAST = new ASTPair();
+               AST expresion1_AST = null;
+               
+               try {      // for error handling
+                       if (_t==null) _t=ASTNULL;
+                       switch ( _t.getType()) {
+                       case O:
+                       {
+                               AST __t9982 = _t;
+                               AST tmp90_AST = null;
+                               AST tmp90_AST_in = null;
+                               tmp90_AST = astFactory.create((AST)_t);
+                               tmp90_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp90_AST);
+                               ASTPair __currentAST9982 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,O);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9982;
+                               _t = __t9982;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case Y:
+                       {
+                               AST __t9983 = _t;
+                               AST tmp91_AST = null;
+                               AST tmp91_AST_in = null;
+                               tmp91_AST = astFactory.create((AST)_t);
+                               tmp91_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp91_AST);
+                               ASTPair __currentAST9983 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,Y);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9983;
+                               _t = __t9983;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case NO:
+                       {
+                               AST __t9984 = _t;
+                               AST tmp92_AST = null;
+                               AST tmp92_AST_in = null;
+                               tmp92_AST = astFactory.create((AST)_t);
+                               tmp92_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp92_AST);
+                               ASTPair __currentAST9984 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,NO);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9984;
+                               _t = __t9984;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MAYOR:
+                       {
+                               AST __t9985 = _t;
+                               AST tmp93_AST = null;
+                               AST tmp93_AST_in = null;
+                               tmp93_AST = astFactory.create((AST)_t);
+                               tmp93_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp93_AST);
+                               ASTPair __currentAST9985 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MAYOR);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9985;
+                               _t = __t9985;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MAYOR_IGUAL:
+                       {
+                               AST __t9986 = _t;
+                               AST tmp94_AST = null;
+                               AST tmp94_AST_in = null;
+                               tmp94_AST = astFactory.create((AST)_t);
+                               tmp94_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp94_AST);
+                               ASTPair __currentAST9986 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MAYOR_IGUAL);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9986;
+                               _t = __t9986;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MENOR:
+                       {
+                               AST __t9987 = _t;
+                               AST tmp95_AST = null;
+                               AST tmp95_AST_in = null;
+                               tmp95_AST = astFactory.create((AST)_t);
+                               tmp95_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp95_AST);
+                               ASTPair __currentAST9987 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MENOR);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9987;
+                               _t = __t9987;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MENOR_IGUAL:
+                       {
+                               AST __t9988 = _t;
+                               AST tmp96_AST = null;
+                               AST tmp96_AST_in = null;
+                               tmp96_AST = astFactory.create((AST)_t);
+                               tmp96_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp96_AST);
+                               ASTPair __currentAST9988 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MENOR_IGUAL);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9988;
+                               _t = __t9988;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case IGUAL:
+                       {
+                               AST __t9989 = _t;
+                               AST tmp97_AST = null;
+                               AST tmp97_AST_in = null;
+                               tmp97_AST = astFactory.create((AST)_t);
+                               tmp97_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp97_AST);
+                               ASTPair __currentAST9989 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,IGUAL);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9989;
+                               _t = __t9989;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case DISTINTO:
+                       {
+                               AST __t9990 = _t;
+                               AST tmp98_AST = null;
+                               AST tmp98_AST_in = null;
+                               tmp98_AST = astFactory.create((AST)_t);
+                               tmp98_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp98_AST);
+                               ASTPair __currentAST9990 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,DISTINTO);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9990;
+                               _t = __t9990;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MAS:
+                       {
+                               AST __t9991 = _t;
+                               AST tmp99_AST = null;
+                               AST tmp99_AST_in = null;
+                               tmp99_AST = astFactory.create((AST)_t);
+                               tmp99_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp99_AST);
+                               ASTPair __currentAST9991 = currentAST.copy();
+                               currentAST.root = currentAST.child;
+                               currentAST.child = null;
+                               match(_t,MAS);
+                               _t = _t.getFirstChild();
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               expresion1(_t);
+                               _t = _retTree;
+                               astFactory.addASTChild(currentAST, returnAST);
+                               currentAST = __currentAST9991;
+                               _t = __t9991;
+                               _t = _t.getNextSibling();
+                               expresion1_AST = (AST)currentAST.root;
+                               break;
+                       }
+                       case MENOS:
+                       {
+                               AST __t9992 = _t;
+                               AST tmp100_AST = null;
+                               AST tmp100_AST_in = null;
+                               tmp100_AST = astFactory.create((AST)_t);
+                               tmp100_AST_in = (AST)_t;
+                               astFactory.addASTChild(currentAST, tmp100_AST);
+