incluidos todos, que no lo habĂ­a hecho antes
[PL2.git] / AnaSem.java
1 // $ANTLR : "AnaSem.g" -> "AnaSem.java"$
2  \r
3         \r
4         import java.util.*; \r
5 \r
6
7 import antlr.TreeParser;
8 import antlr.Token;
9 import antlr.collections.AST;
10 import antlr.RecognitionException;
11 import antlr.ANTLRException;
12 import antlr.NoViableAltException;
13 import antlr.MismatchedTokenException;
14 import antlr.SemanticException;
15 import antlr.collections.impl.BitSet;
16 import antlr.ASTPair;
17 import antlr.collections.impl.ASTArray;
18
19
20 public class AnaSem extends antlr.TreeParser       implements AnaSemTokenTypes
21  {
22  \r
23   int cont_dev; // variable contador del numero de instrucciones DEV en un metodo\r
24         \r
25         \r
26         Atr_Expr AS_Literal(AST lit){\r
27                 Atr_Expr result = new Atr_Expr();\r
28                 AST tipo;\r
29                 if(lit == null) return null;\r
30                 switch(lit.getType()){\r
31                 case LIT_ENTERO: \r
32                         tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(ENTERO,"entero")));\r
33                         break;\r
34                 case LIT_REAL:\r
35                         tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(REAL,"real")));\r
36                         break;\r
37                 case LIT_CAR: \r
38                         tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(CARACTER,"caracter")));\r
39                         break;\r
40                 case CIERTO:\r
41                 case FALSO:\r
42                         tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(LOGICO,"logico")));\r
43                         break;\r
44                 default:\r
45                         return null;\r
46                 }\r
47                 result.setTipo(tipo);\r
48                 result.setLVal(false);\r
49                 result.setRVal(true);\r
50                 return result;\r
51         }\r
52         \r
53         Atr_Expr AS_Acceso_Simple(AST dec){\r
54                 Atr_Expr result = new Atr_Expr();\r
55                 AST tipo = null;\r
56                 if (dec == null) return null;\r
57                 switch(dec.getType()){\r
58                 case MODULO:\r
59                         System.out.println("ERROR CT: el tipo es modulo");\r
60                         return null;\r
61                 case CLASE: //acceso a clase no instanciable\r
62                         tipo = dec;\r
63                         result.setLVal(false);\r
64                         result.setRVal(false);\r
65                         break;\r
66                 case ATRIBUTO://acceso a un atributo de la propia clase\r
67                         tipo = dec.getFirstChild().getNextSibling();\r
68                         result.setLVal(true);\r
69                         result.setRVal(true);\r
70                         break;\r
71                 case METODO: //acceso a un metodo de la propia clase\r
72                         tipo = dec.getFirstChild();\r
73                         result.setLVal(false);\r
74                         result.setRVal(false);\r
75                         break;\r
76                 case PARAMETRO:\r
77                         tipo = dec.getFirstChild().getNextSibling();\r
78                         result.setLVal(false);\r
79                         result.setRVal(true);\r
80                         break;\r
81                 case VARIABLE_LOCAL:\r
82                         tipo = dec.getFirstChild().getNextSibling();\r
83                         result.setLVal(true);\r
84                         result.setRVal(true);\r
85                         break;\r
86                 case ERROR:\r
87                         return null;\r
88                 }\r
89                 result.setTipo(tipo);\r
90                 return result;\r
91         }\r
92         \r
93         Atr_Expr AS_Acceso_Objeto(Atr_Expr atr_raiz, AST raiz, AST atrib){\r
94                 Atr_Expr result = new Atr_Expr();\r
95                 AST tipo, tipo_raiz, aux;\r
96                 if(atr_raiz == null || raiz == null || atrib ==null) return null;\r
97                 //comprobar que el tipo de la raiz sea clase\r
98                 tipo_raiz = atr_raiz.getTipo();\r
99                 if(tipo_raiz.getType() != CLASE){\r
100                         System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" no es una clase");\r
101                         return null;\r
102                 }\r
103                 //si la raiz es una clase instanciable\r
104                 if(raiz.getFirstChild().getNextSibling().getType() == CLASE){\r
105                         if(tipo_raiz.getFirstChild().getNextSibling().getType() != NO_INST){\r
106                                 System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" es una clase instanciable");\r
107                                 return null;\r
108                         }\r
109                 }\r
110                 //si la raiz es un objeto\r
111                 else{\r
112                         if(tipo_raiz.getFirstChild().getNextSibling().getType() != INST){\r
113                                 System.out.println("ERROR CT: "+raiz.getFirstChild().getText()+" es un objeto de clase no instanciable");\r
114                                 return null;\r
115                         }\r
116                 }\r
117                 //comprobar que "atrib" sea un atributo o metodo de la clase y ademas sea visible\r
118                 aux = tipo_raiz.getFirstChild().getNextSibling().getNextSibling();\r
119                 while(aux!= null){\r
120                         if(aux.getType() == METODO){\r
121                                 if(aux.getFirstChild().getFirstChild().equals(atrib))\r
122                                         break;\r
123                         }else{ //atributo\r
124                                 if(aux.getFirstChild().equals(atrib))\r
125                                         break;\r
126                         }\r
127                         aux = aux.getNextSibling();\r
128                 }\r
129                 if(aux == null){\r
130                         System.out.println("ERROR CT: el atributo "+atrib.getText()+" no pertenece a la clase "+raiz.getFirstChild().getText());\r
131                         return null;\r
132                 }\r
133                 if(aux.getFirstChild().getNextSibling().getNextSibling().getType() != VISIBLE){\r
134                         System.out.println("ERROR CT: el atributo "+atrib.getText()+" no es visible");\r
135                         return null;\r
136                 }\r
137                 \r
138                 //tipo de la expresion\r
139                 if(aux.getType() == METODO){\r
140                         tipo = aux.getFirstChild();\r
141                         result.setLVal(false);\r
142                         result.setRVal(false);\r
143                 }else{ //atributo\r
144                         tipo = aux.getFirstChild().getNextSibling();\r
145                         result.setLVal(true);\r
146                         result.setRVal(true);\r
147                 }\r
148                 result.setTipo(tipo);\r
149                 return result;\r
150         \r
151         }\r
152         \r
153         //hay que pasarle la raiz para saber el nombre de la raiz cuando no es un metodo\r
154         Atr_Expr AS_Llamada(Atr_Expr atr_raiz, LinkedList expresiones){\r
155                 ListIterator it = expresiones.listIterator();\r
156                 Atr_Expr result = new Atr_Expr();\r
157                 AST pars, par_f, tipo;\r
158                 Atr_Expr par_r;\r
159                 \r
160                 //comprobar que atr_raiz no se a null\r
161                 if(atr_raiz == null || expresiones == null){\r
162                         return null;\r
163                 }\r
164                 //comprobar que la raiz sea de tipo prototipo\r
165                 if(atr_raiz.getTipo().getType() != PROTOTIPO){\r
166                         System.out.println("ERROR CT: "+atr_raiz.getTipo().getText()+" no es un metodo.");\r
167                         return null;\r
168                 }\r
169                 //comprobar que los parametros reales coinciden con los formales\r
170                 pars = atr_raiz.getTipo().getFirstChild().getNextSibling();\r
171                 par_f = pars.getFirstChild();\r
172                 while (it.hasNext() && (par_f != null)){\r
173                         par_r = (Atr_Expr)it.next();\r
174                         if(! par_f.getFirstChild().getNextSibling().equalsTree(par_r.getTipo())){\r
175                                 System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
176                                 return null;\r
177                         }\r
178                         par_f = par_f.getNextSibling();\r
179                 }\r
180                 if(it.hasNext() && (par_f == null)){\r
181                         System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
182                         return null;\r
183                 }\r
184                 if(!it.hasNext() && (par_f != null)){\r
185                         System.out.println("ERROR CT: El numero de parametros en el metodo \""+atr_raiz.getTipo().getFirstChild().getText()+"\" es incorrecto.");\r
186                         return null;\r
187                 }\r
188                 //el tipo de la expresion es el rango del metodo\r
189                 tipo = atr_raiz.getTipo().getFirstChild().getNextSibling().getNextSibling().getFirstChild();\r
190                 result.setLVal(false);\r
191                 result.setRVal(true);\r
192                 result.setTipo(tipo);\r
193                 return result;\r
194         }\r
195         \r
196         Atr_Expr AS_Acceso_Tabla(Atr_Expr atr_raiz, LinkedList expresiones){\r
197                 if(atr_raiz == null || expresiones == null) return null;\r
198                 ListIterator it = expresiones.listIterator();\r
199                 Atr_Expr result = new Atr_Expr();\r
200                 Atr_Expr aux;\r
201                 AST tipo;\r
202                 int tam = 0;\r
203                 //comprobar que el tipo de la raizes una formacion\r
204                 //TODO\r
205                 if(atr_raiz.getTipo().getType() != FORMACION){\r
206                         System.out.println("ERROR CT: intentando acceder a \""+atr_raiz.getTipo().getText()+"\" como formacion");\r
207                         return null;\r
208                 }\r
209                 //comprobar que el numero de expresiones coincida con el numero  de dimensiones\r
210                 while(it.hasNext()){\r
211                         tam++;\r
212                         aux = (Atr_Expr) it.next();\r
213                         if(aux == null) return null;\r
214                         if(aux.getTipo().getType() != ENTERO){\r
215                                 System.out.println("ERROR CT: no coinciden el numero de expresiones en el acceso a formacion");\r
216                                 return null;\r
217                         }\r
218                 }\r
219                 if(tam != atr_raiz.getTipo().getFirstChild().getNumberOfChildren()){\r
220                         System.out.println("ERROR CT: no coinciden el numero de expresiones en el acceso a formacion");\r
221                         return null;\r
222                 }\r
223                 tipo = atr_raiz.getTipo().getFirstChild().getNextSibling();\r
224                 result.setTipo(tipo);\r
225                 result.setLVal(atr_raiz.getLVal());\r
226                 result.setRVal(atr_raiz.getRVal());\r
227                 return result;\r
228         }\r
229         \r
230         \r
231         \r
232         //AS DE EXPRESIONES\r
233   \r
234   //Expresiones binarias aritmeticas\r
235   Atr_Expr AS_Exp_Bin_Arit(Atr_Expr e1, Atr_Expr e2){\r
236         Atr_Expr result = new Atr_Expr();\r
237         String men="";\r
238         if(e1 == null || e2 == null) return null;\r
239         \r
240         //Comprobamos que e1 y e2 sean consultables\r
241         if(!e1.getLVal() || !e2.getRVal()){\r
242                 if (!e2.getRVal()) men="ERROR LR: la expresion no puede aparecer a la derecha de una expresion binaria" ;\r
243                 if (!e1.getLVal()) men="ERROR LR: la expresion no puede aparecer a la izquierda de una expresion binaria" ;\r
244                 System.out.println(men);\r
245                 return null;\r
246         }\r
247         \r
248         //Comprobamos que e1 y e2 sean numericas y compatibles\r
249         if((e1.getTipo().getType()!=ENTERO) && (e1.getTipo().getType()!=REAL) ||\r
250         (e2.getTipo().getType()!=ENTERO) && (e2.getTipo().getType()!=REAL)){\r
251                 System.out.println("ERROR CT: no son expresiones numericas ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
252                 return null;\r
253         }\r
254         if(!e1.getTipo().equals(e2.getTipo())){\r
255                 System.out.println("ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
256                 return null;\r
257         }\r
258         \r
259         //Calculamos el tipo\r
260         result.setTipo(e1.getTipo());\r
261         result.setLVal(false);\r
262         result.setRVal(true);\r
263         \r
264         return result;\r
265   }\r
266   \r
267   \r
268   //Expresiones binarias logicas\r
269   Atr_Expr AS_Exp_Bin_Log(Atr_Expr e1, Atr_Expr e2){\r
270         Atr_Expr result = new Atr_Expr();\r
271         String men = "";\r
272         \r
273         if(e1 == null || e2 == null) return null;\r
274         //Comprobar que las expresiones son consultables\r
275         if(!e1.getLVal() || !e2.getRVal()){\r
276                 if (!e2.getRVal()) men ="ERROR LR: la expresion no puede aparecer a la derecha de la expresion" ;\r
277                 if (!e1.getLVal()) men ="ERROR LR: la expresion "+e1.getTipo().getFirstChild().getText()+" no puede aparecer a la izquierda de la expresion" ;\r
278                 System.out.println(men);\r
279                 return null;\r
280         }\r
281         \r
282         //Comprobamos que sean de tipo logico\r
283         if((e1.getTipo().getType()!=LOGICO) || (e2.getTipo().getType()!=LOGICO)){\r
284                 if (e1.getTipo().getType()!=LOGICO)\r
285                         men = "ERROR CT: la expresion "+e1.getTipo().getFirstChild().getText()+"no es de tipo logico";\r
286                 if (e2.getTipo().getType()!=LOGICO)\r
287                         men = "ERROR CT: la expresion "+e2.getTipo().getFirstChild().getText()+"no es de tipo logico";\r
288                 System.out.println(men);\r
289                 return null;\r
290         }\r
291         \r
292         //Calculamos el tipo\r
293         result.setTipo(e1.getTipo());\r
294         result.setLVal(false);\r
295         result.setRVal(true);\r
296         \r
297         return result;\r
298   }\r
299   \r
300   //Expresiones binarias relacionales\r
301   Atr_Expr AS_Exp_Bin_Rel(Atr_Expr e1, Atr_Expr e2, AST operador){\r
302         Atr_Expr result = new Atr_Expr();\r
303         AST tipo;\r
304         String men = "";\r
305         \r
306         if(e1 == null || e2 == null || operador == null) return null;\r
307         //Comprobamos que las expresiones son consultables\r
308         if(!e1.getLVal() || !e2.getRVal()){\r
309                 if (!e2.getRVal()) men ="ERROR LR: la expresion no se puede consultar en la expresion binaria" ;\r
310                 if (!e1.getLVal()) men ="ERROR LR: la expresion "+e1.getTipo().getFirstChild().getText()+" no puede aparecer a la izquierda en la expresion";\r
311                 System.out.println(men);\r
312                 return null;\r
313         }\r
314         \r
315         //No dejamos que se utilicen formaciones y comprobamos la compatibilidad de las expresiones\r
316         if(e1.getTipo().getType()==FORMACION){\r
317                 System.out.println("ERROR CT: no puede tener formaciones en expresiones relacionales");\r
318                 return null;\r
319         }\r
320         men = "ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")";\r
321         if(!e1.getTipo().equals(e2.getTipo())){\r
322                 System.out.println(men);\r
323                 return null;\r
324         }\r
325 \r
326         if((e1.getTipo().getType() == CLASE) && (!e1.getTipo().getFirstChild().equals(e2.getTipo().getFirstChild()))){ //Comparamos las clases por nombre\r
327                 System.out.println(men);\r
328                 return null;\r
329         }\r
330         \r
331         //Miramos los grupos de operadores\r
332         if((operador.getType()!=IGUAL && operador.getType()!=DISTINTO) && (e1.getTipo().getType()==CLASE || e1.getTipo().getType()==LOGICO)){\r
333                 System.out.println("ERROR CT: el operador \""+operador.getText()+"\" no esta permitido para los tipos usados ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")");\r
334                 return null;\r
335         }\r
336         \r
337         //Establecemos el tipo\r
338         tipo = (AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(LOGICO,"logico")));\r
339         result.setTipo(tipo);\r
340         result.setLVal(false);\r
341         result.setRVal(true);\r
342         \r
343         return result;\r
344   }\r
345   \r
346   //Expresiones unarias aritmeticas == MENOS UNARIO\r
347   Atr_Expr AS_Exp_Una_Arit(Atr_Expr e){\r
348         Atr_Expr result = new Atr_Expr();\r
349         String men="";\r
350         \r
351         if(e == null) return null;\r
352         //e tiene que ser consultable\r
353         if(!e.getRVal()){\r
354                 men ="ERROR LR: la expresion no es consultable" ;\r
355                 System.out.println(men);\r
356                 return null;\r
357         }\r
358         \r
359         //comprobar que e es de tipo numerico\r
360         if( e.getTipo().getType()!=ENTERO && e.getTipo().getType()!=REAL){\r
361                 System.out.println("ERROR CT: el menos unario solo puede ser utilizado en expresiones numericas");\r
362                 return null;\r
363         }\r
364         \r
365         //Establecemos el tipo\r
366         result.setTipo(e.getTipo());\r
367         result.setLVal(false);\r
368         result.setRVal(true);\r
369         \r
370         return result;\r
371   }\r
372   \r
373   //Expresiones unarias logicas == NEGACION\r
374   //Identica a la anterior\r
375   Atr_Expr AS_Exp_Una_Log(Atr_Expr e){\r
376         Atr_Expr result = new Atr_Expr();\r
377         \r
378         if(e == null) return null;\r
379         //e tiene que ser consultable\r
380         if(!e.getRVal()){\r
381                 System.out.println("ERROR LR: la expresion no es consultable" );\r
382                 return null;\r
383         }\r
384         \r
385         //comprobar que e es de tipo numerico\r
386         if( e.getTipo().getType()!=LOGICO){\r
387                 System.out.println("ERROR CT: la negacion solo se puede utilizar con expresiones logicas");\r
388                 return null;\r
389         }\r
390         \r
391         //Establecemos el tipo\r
392         result.setTipo(e.getTipo());\r
393         result.setLVal(false);\r
394         result.setRVal(true);\r
395         \r
396         return result;\r
397   }\r
398   \r
399   //Instrucciones\r
400   //Asignacion\r
401   void AS_Asignacion(Atr_Expr e1, Atr_Expr e2, AST e3, AST e4){\r
402         //comprobar si alguno es null\r
403         String men = "";\r
404         if(e1==null || e2 == null) return;\r
405                 \r
406         //Comprobamos la consultabilidad de las expresiones\r
407         if(!e1.getLVal() || !e2.getRVal()){\r
408                 if (!e2.getRVal())\r
409                         men ="ERROR LR: la expresion "+e4.getFirstChild().getText()+" no puede aparecer a la derecha de una asignacion." ;\r
410                 if (!e1.getLVal()) men ="ERROR LR: el "+e3.getFirstChild().getNextSibling().getText()+" "+e3.getFirstChild().getText()+" no puede aparecer a la izquierda de una asignacion." ;\r
411                 System.out.println(men);\r
412                 return;\r
413         }\r
414         \r
415         //No dejamos asignar formaciones y comprobamos la compatibilidad de tipos\r
416         if(e1.getTipo().getType()==FORMACION){\r
417                 System.out.println("ERROR CT: no dejamos asignar formaciones");\r
418         }\r
419         men = "ERROR CT: Los tipos no son compatibles ("+e1.getTipo().getText()+" y "+e2.getTipo().getText()+")";\r
420         if(!e1.getTipo().equals(e2.getTipo())){\r
421                 System.out.println(men);\r
422         }\r
423         if((e1.getTipo().getType() == CLASE) && (!e1.getTipo().getFirstChild().equals(e2.getTipo().getFirstChild()))){ //Comparamos las clases por nombre\r
424                 System.out.println(men);\r
425         }\r
426   }\r
427   \r
428   //Condiciones\r
429   void AS_Condicional(Atr_Expr e){\r
430         String men = "";\r
431         if (e == null) return;\r
432         if(!e.getRVal()){\r
433                 men ="ERROR LR: la expresion no es consultable" ;\r
434                 System.out.println(men);\r
435                 return;\r
436         }\r
437         \r
438         //Comprobamos que es de tipo logico\r
439         if(e.getTipo().getType()!=LOGICO){\r
440                 System.out.println("ERROR CT: no es un tipo logico");\r
441         }\r
442   }\r
443   \r
444   //Instruccion de devolucion\r
445   int AS_Devolucion(AST tipo_dev, Atr_Expr e, int cont){\r
446         String men = "";\r
447 //  String men = "ERROR CT: Los tipos no son compatibles (entero y real)"\r
448         if(tipo_dev == null || e == null) return cont+1;\r
449         //Comprobamos que el metodo sea funcional\r
450 \r
451         if(cont == -1){\r
452                 System.out.println("ERROR CT: el metodo no es funcional");\r
453                 return -1;\r
454         }\r
455 \r
456         //Comprobar que la expresion e es consultable\r
457         if(!e.getRVal()){\r
458                 System.out.println("ERROR CT: la expresion no es consultable, no se puede devolver");\r
459         }\r
460         \r
461         men = "ERROR CT: Los tipos no son compatibles ("+e.getTipo().getText()+" y "+tipo_dev.getText()+")";\r
462         //Comprobamos que el tipo de la expresion es compatible con el tipo que se devuelve\r
463         if(!e.getTipo().equals(tipo_dev)){\r
464                 System.out.println(men);\r
465         }\r
466         if(tipo_dev.getType()==CLASE && (!tipo_dev.getFirstChild().equals(e.getTipo().getFirstChild()))){\r
467                 System.out.println(men);\r
468         }\r
469         \r
470         if(tipo_dev.getType()==FORMACION && (!tipo_dev.equals(e.getTipo()))){\r
471                 System.out.println(men);\r
472         }\r
473         \r
474         return cont + 1;\r
475   }\r
476   \r
477   \r
478   Atr_Expr AS_Crear(Atr_Expr as, AST clase){\r
479                 if (as == null || clase == null){\r
480                         System.out.println("ERROR CT: no se puede crear");\r
481                          return null;\r
482                 }\r
483                 //comprobar que el tipo de la variable es el mismo que el del interior de crear\r
484                 Atr_Expr result = new Atr_Expr();\r
485                 AST tipo = as.getTipo();\r
486                 if(tipo.getType() != CLASE){\r
487                         System.out.println("ERROR CT: no es una clase");\r
488                         return null;\r
489                 }\r
490                 if(!(tipo.getFirstChild().getNextSibling().getType() == INST)){\r
491                         System.out.println("ERROR CT: la clase no es instanciable");\r
492                         return null;\r
493                 }\r
494                 AST tipo_var = tipo.getFirstChild();\r
495                 AST interior = clase;\r
496                 if(!tipo_var.getText().equals(interior.getText())){\r
497                         if(interior.getType() == ACCESO_SIMPLE)\r
498                                 System.out.println("ERROR CT: Los tipos no son compatibles ("+tipo_var.getText()+" y "+interior.getFirstChild().getText()+")");\r
499                         else\r
500                                 System.out.println("ERROR CT: Los tipos no son compatibles ("+tipo_var.getText()+" y "+interior.getText()+")");\r
501                         return null;\r
502                 }\r
503                 //hay que comprobar que la clase es instanciable, y que el tipo es clase\r
504 \r
505                 result.setLVal(false);\r
506                 result.setRVal(false);\r
507                 //el tipo es el de la variable\r
508                 result.setTipo(tipo);\r
509                 \r
510                 return result;\r
511         }       \r
512         \r
513         //AS Escribir\r
514         void AS_Escribir(Atr_Expr e, AST exp){\r
515                 if (e == null){\r
516                         if(exp.getType() == ACCESO_SIMPLE)\r
517                                 System.out.println("ERROR CT: no se puede escribir "+ exp.getFirstChild().getText());\r
518                         else\r
519                                 System.out.println("ERROR CT: no se puede escribir "+ exp.getText());\r
520                         return;\r
521                 }\r
522                 //Comprobamos que la expresion se pueda consultar\r
523                 if(!e.getRVal()){\r
524                         System.out.println("ERROR CT: la expresion no es consultable, no se puede escribir");\r
525                 }\r
526         }\r
527 \r
528   \r
529   //AS Entero A Real\r
530   Atr_Expr AS_Entero_A_Real(Atr_Expr e1){\r
531         Atr_Expr result = new Atr_Expr();\r
532         if (e1 == null) return null;\r
533         AST tipo = e1.getTipo();\r
534         if(tipo.getType() != ENTERO){\r
535                 System.out.println("ERROR CT: El tipo del parametro del operador enteroareal es incorrecto.");\r
536                 return null;\r
537           }\r
538         result.setTipo((AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(REAL,"real"))));\r
539         result.setLVal(false);\r
540         result.setRVal(true);\r
541         return result;\r
542   }\r
543   Atr_Expr AS_Real_A_Entero(Atr_Expr e1){\r
544         Atr_Expr result = new Atr_Expr();\r
545         \r
546         if (e1 == null) return null;\r
547         AST tipo = e1.getTipo();\r
548         if(tipo.getType() != REAL){\r
549                 System.out.println("ERROR CT: El tipo del parametro del operador realaentero es incorrecto.");\r
550                 return null;\r
551         }\r
552         result.setTipo((AST)astFactory.make( (new ASTArray(1)).add(astFactory.create(ENTERO,"entero"))));\r
553         result.setLVal(false);\r
554         result.setRVal(true);\r
555         return result;\r
556   }\r
557   \r
558   \r
559 public AnaSem() {
560         tokenNames = _tokenNames;
561 }
562
563         public final void declaracion_modulo(AST _t) throws RecognitionException {
564                 
565                 AST declaracion_modulo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
566                 returnAST = null;
567                 ASTPair currentAST = new ASTPair();
568                 AST declaracion_modulo_AST = null;
569                 
570                 try {      // for error handling
571                         AST __t9810 = _t;
572                         AST tmp1_AST = null;
573                         AST tmp1_AST_in = null;
574                         tmp1_AST = astFactory.create((AST)_t);
575                         tmp1_AST_in = (AST)_t;
576                         astFactory.addASTChild(currentAST, tmp1_AST);
577                         ASTPair __currentAST9810 = currentAST.copy();
578                         currentAST.root = currentAST.child;
579                         currentAST.child = null;
580                         match(_t,MODULO);
581                         _t = _t.getFirstChild();
582                         nombre_modulo(_t);
583                         _t = _retTree;
584                         astFactory.addASTChild(currentAST, returnAST);
585                         definicion_modulo(_t);
586                         _t = _retTree;
587                         astFactory.addASTChild(currentAST, returnAST);
588                         currentAST = __currentAST9810;
589                         _t = __t9810;
590                         _t = _t.getNextSibling();
591                         declaracion_modulo_AST = (AST)currentAST.root;
592                 }
593                 catch (RecognitionException ex) {
594                         reportError(ex);
595                         if (_t!=null) {_t = _t.getNextSibling();}
596                 }
597                 returnAST = declaracion_modulo_AST;
598                 _retTree = _t;
599         }
600         
601         public final void nombre_modulo(AST _t) throws RecognitionException {
602                 
603                 AST nombre_modulo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
604                 returnAST = null;
605                 ASTPair currentAST = new ASTPair();
606                 AST nombre_modulo_AST = null;
607                 
608                 try {      // for error handling
609                         AST tmp2_AST = null;
610                         AST tmp2_AST_in = null;
611                         tmp2_AST = astFactory.create((AST)_t);
612                         tmp2_AST_in = (AST)_t;
613                         astFactory.addASTChild(currentAST, tmp2_AST);
614                         match(_t,IDENT);
615                         _t = _t.getNextSibling();
616                         nombre_modulo_AST = (AST)currentAST.root;
617                 }
618                 catch (RecognitionException ex) {
619                         reportError(ex);
620                         if (_t!=null) {_t = _t.getNextSibling();}
621                 }
622                 returnAST = nombre_modulo_AST;
623                 _retTree = _t;
624         }
625         
626         public final void definicion_modulo(AST _t) throws RecognitionException {
627                 
628                 AST definicion_modulo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
629                 returnAST = null;
630                 ASTPair currentAST = new ASTPair();
631                 AST definicion_modulo_AST = null;
632                 
633                 try {      // for error handling
634                         lista_declaraciones_clases(_t);
635                         _t = _retTree;
636                         astFactory.addASTChild(currentAST, returnAST);
637                         definicion_modulo_AST = (AST)currentAST.root;
638                 }
639                 catch (RecognitionException ex) {
640                         reportError(ex);
641                         if (_t!=null) {_t = _t.getNextSibling();}
642                 }
643                 returnAST = definicion_modulo_AST;
644                 _retTree = _t;
645         }
646         
647         public final void lista_declaraciones_clases(AST _t) throws RecognitionException {
648                 
649                 AST lista_declaraciones_clases_AST_in = (_t == ASTNULL) ? null : (AST)_t;
650                 returnAST = null;
651                 ASTPair currentAST = new ASTPair();
652                 AST lista_declaraciones_clases_AST = null;
653                 
654                 try {      // for error handling
655                         {
656                         _loop9815:
657                         do {
658                                 if (_t==null) _t=ASTNULL;
659                                 if ((_t.getType()==CLASE)) {
660                                         declaracion_clase(_t);
661                                         _t = _retTree;
662                                         astFactory.addASTChild(currentAST, returnAST);
663                                 }
664                                 else {
665                                         break _loop9815;
666                                 }
667                                 
668                         } while (true);
669                         }
670                         lista_declaraciones_clases_AST = (AST)currentAST.root;
671                 }
672                 catch (RecognitionException ex) {
673                         reportError(ex);
674                         if (_t!=null) {_t = _t.getNextSibling();}
675                 }
676                 returnAST = lista_declaraciones_clases_AST;
677                 _retTree = _t;
678         }
679         
680         public final void declaracion_clase(AST _t) throws RecognitionException {
681                 
682                 AST declaracion_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
683                 returnAST = null;
684                 ASTPair currentAST = new ASTPair();
685                 AST declaracion_clase_AST = null;
686                 
687                 try {      // for error handling
688                         AST __t9817 = _t;
689                         AST tmp3_AST = null;
690                         AST tmp3_AST_in = null;
691                         tmp3_AST = astFactory.create((AST)_t);
692                         tmp3_AST_in = (AST)_t;
693                         astFactory.addASTChild(currentAST, tmp3_AST);
694                         ASTPair __currentAST9817 = currentAST.copy();
695                         currentAST.root = currentAST.child;
696                         currentAST.child = null;
697                         match(_t,CLASE);
698                         _t = _t.getFirstChild();
699                         nombre_clase(_t);
700                         _t = _retTree;
701                         astFactory.addASTChild(currentAST, returnAST);
702                         cualificador_clase(_t);
703                         _t = _retTree;
704                         astFactory.addASTChild(currentAST, returnAST);
705                         definicion_clase(_t);
706                         _t = _retTree;
707                         astFactory.addASTChild(currentAST, returnAST);
708                         currentAST = __currentAST9817;
709                         _t = __t9817;
710                         _t = _t.getNextSibling();
711                         declaracion_clase_AST = (AST)currentAST.root;
712                 }
713                 catch (RecognitionException ex) {
714                         reportError(ex);
715                         if (_t!=null) {_t = _t.getNextSibling();}
716                 }
717                 returnAST = declaracion_clase_AST;
718                 _retTree = _t;
719         }
720         
721         public final void nombre_clase(AST _t) throws RecognitionException {
722                 
723                 AST nombre_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
724                 returnAST = null;
725                 ASTPair currentAST = new ASTPair();
726                 AST nombre_clase_AST = null;
727                 
728                 try {      // for error handling
729                         AST tmp4_AST = null;
730                         AST tmp4_AST_in = null;
731                         tmp4_AST = astFactory.create((AST)_t);
732                         tmp4_AST_in = (AST)_t;
733                         astFactory.addASTChild(currentAST, tmp4_AST);
734                         match(_t,IDENT);
735                         _t = _t.getNextSibling();
736                         nombre_clase_AST = (AST)currentAST.root;
737                 }
738                 catch (RecognitionException ex) {
739                         reportError(ex);
740                         if (_t!=null) {_t = _t.getNextSibling();}
741                 }
742                 returnAST = nombre_clase_AST;
743                 _retTree = _t;
744         }
745         
746         public final void cualificador_clase(AST _t) throws RecognitionException {
747                 
748                 AST cualificador_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
749                 returnAST = null;
750                 ASTPair currentAST = new ASTPair();
751                 AST cualificador_clase_AST = null;
752                 
753                 try {      // for error handling
754                         if (_t==null) _t=ASTNULL;
755                         switch ( _t.getType()) {
756                         case INST:
757                         {
758                                 AST tmp5_AST = null;
759                                 AST tmp5_AST_in = null;
760                                 tmp5_AST = astFactory.create((AST)_t);
761                                 tmp5_AST_in = (AST)_t;
762                                 astFactory.addASTChild(currentAST, tmp5_AST);
763                                 match(_t,INST);
764                                 _t = _t.getNextSibling();
765                                 cualificador_clase_AST = (AST)currentAST.root;
766                                 break;
767                         }
768                         case NO_INST:
769                         {
770                                 AST tmp6_AST = null;
771                                 AST tmp6_AST_in = null;
772                                 tmp6_AST = astFactory.create((AST)_t);
773                                 tmp6_AST_in = (AST)_t;
774                                 astFactory.addASTChild(currentAST, tmp6_AST);
775                                 match(_t,NO_INST);
776                                 _t = _t.getNextSibling();
777                                 cualificador_clase_AST = (AST)currentAST.root;
778                                 break;
779                         }
780                         default:
781                         {
782                                 throw new NoViableAltException(_t);
783                         }
784                         }
785                 }
786                 catch (RecognitionException ex) {
787                         reportError(ex);
788                         if (_t!=null) {_t = _t.getNextSibling();}
789                 }
790                 returnAST = cualificador_clase_AST;
791                 _retTree = _t;
792         }
793         
794         public final void definicion_clase(AST _t) throws RecognitionException {
795                 
796                 AST definicion_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
797                 returnAST = null;
798                 ASTPair currentAST = new ASTPair();
799                 AST definicion_clase_AST = null;
800                 
801                 try {      // for error handling
802                         declaraciones_elementos_clase(_t);
803                         _t = _retTree;
804                         astFactory.addASTChild(currentAST, returnAST);
805                         definicion_clase_AST = (AST)currentAST.root;
806                 }
807                 catch (RecognitionException ex) {
808                         reportError(ex);
809                         if (_t!=null) {_t = _t.getNextSibling();}
810                 }
811                 returnAST = definicion_clase_AST;
812                 _retTree = _t;
813         }
814         
815         public final void declaraciones_elementos_clase(AST _t) throws RecognitionException {
816                 
817                 AST declaraciones_elementos_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
818                 returnAST = null;
819                 ASTPair currentAST = new ASTPair();
820                 AST declaraciones_elementos_clase_AST = null;
821                 
822                 try {      // for error handling
823                         {
824                         _loop9823:
825                         do {
826                                 if (_t==null) _t=ASTNULL;
827                                 if ((_t.getType()==ATRIBUTO||_t.getType()==METODO)) {
828                                         declaracion_elemento_clase(_t);
829                                         _t = _retTree;
830                                         astFactory.addASTChild(currentAST, returnAST);
831                                 }
832                                 else {
833                                         break _loop9823;
834                                 }
835                                 
836                         } while (true);
837                         }
838                         declaraciones_elementos_clase_AST = (AST)currentAST.root;
839                 }
840                 catch (RecognitionException ex) {
841                         reportError(ex);
842                         if (_t!=null) {_t = _t.getNextSibling();}
843                 }
844                 returnAST = declaraciones_elementos_clase_AST;
845                 _retTree = _t;
846         }
847         
848         public final void declaracion_elemento_clase(AST _t) throws RecognitionException {
849                 
850                 AST declaracion_elemento_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
851                 returnAST = null;
852                 ASTPair currentAST = new ASTPair();
853                 AST declaracion_elemento_clase_AST = null;
854                 
855                 try {      // for error handling
856                         if (_t==null) _t=ASTNULL;
857                         switch ( _t.getType()) {
858                         case METODO:
859                         {
860                                 AST __t9825 = _t;
861                                 AST tmp7_AST = null;
862                                 AST tmp7_AST_in = null;
863                                 tmp7_AST = astFactory.create((AST)_t);
864                                 tmp7_AST_in = (AST)_t;
865                                 astFactory.addASTChild(currentAST, tmp7_AST);
866                                 ASTPair __currentAST9825 = currentAST.copy();
867                                 currentAST.root = currentAST.child;
868                                 currentAST.child = null;
869                                 match(_t,METODO);
870                                 _t = _t.getFirstChild();
871                                 declaracion_metodo(_t);
872                                 _t = _retTree;
873                                 astFactory.addASTChild(currentAST, returnAST);
874                                 cualificador_elemento_clase(_t);
875                                 _t = _retTree;
876                                 astFactory.addASTChild(currentAST, returnAST);
877                                 currentAST = __currentAST9825;
878                                 _t = __t9825;
879                                 _t = _t.getNextSibling();
880                                 declaracion_elemento_clase_AST = (AST)currentAST.root;
881                                 break;
882                         }
883                         case ATRIBUTO:
884                         {
885                                 AST __t9826 = _t;
886                                 AST tmp8_AST = null;
887                                 AST tmp8_AST_in = null;
888                                 tmp8_AST = astFactory.create((AST)_t);
889                                 tmp8_AST_in = (AST)_t;
890                                 astFactory.addASTChild(currentAST, tmp8_AST);
891                                 ASTPair __currentAST9826 = currentAST.copy();
892                                 currentAST.root = currentAST.child;
893                                 currentAST.child = null;
894                                 match(_t,ATRIBUTO);
895                                 _t = _t.getFirstChild();
896                                 AST tmp9_AST = null;
897                                 AST tmp9_AST_in = null;
898                                 tmp9_AST = astFactory.create((AST)_t);
899                                 tmp9_AST_in = (AST)_t;
900                                 astFactory.addASTChild(currentAST, tmp9_AST);
901                                 match(_t,IDENT);
902                                 _t = _t.getNextSibling();
903                                 tipo(_t);
904                                 _t = _retTree;
905                                 astFactory.addASTChild(currentAST, returnAST);
906                                 cualificador_elemento_clase(_t);
907                                 _t = _retTree;
908                                 astFactory.addASTChild(currentAST, returnAST);
909                                 currentAST = __currentAST9826;
910                                 _t = __t9826;
911                                 _t = _t.getNextSibling();
912                                 declaracion_elemento_clase_AST = (AST)currentAST.root;
913                                 break;
914                         }
915                         default:
916                         {
917                                 throw new NoViableAltException(_t);
918                         }
919                         }
920                 }
921                 catch (RecognitionException ex) {
922                         reportError(ex);
923                         if (_t!=null) {_t = _t.getNextSibling();}
924                 }
925                 returnAST = declaracion_elemento_clase_AST;
926                 _retTree = _t;
927         }
928         
929         public final void declaracion_metodo(AST _t) throws RecognitionException {
930                 
931                 AST declaracion_metodo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
932                 returnAST = null;
933                 ASTPair currentAST = new ASTPair();
934                 AST declaracion_metodo_AST = null;
935                 AST tipodev;
936                 
937                 try {      // for error handling
938                         tipodev=prototipo_metodo(_t);
939                         _t = _retTree;
940                         astFactory.addASTChild(currentAST, returnAST);
941                         definicion_metodo(_t,tipodev);
942                         _t = _retTree;
943                         astFactory.addASTChild(currentAST, returnAST);
944                         if (cont_dev == 0){
945                                 System.out.println("ERROR: Metodo funcional que no devuelve nada");
946                                 System.exit(-1);
947                         }
948                         
949                         declaracion_metodo_AST = (AST)currentAST.root;
950                 }
951                 catch (RecognitionException ex) {
952                         reportError(ex);
953                         if (_t!=null) {_t = _t.getNextSibling();}
954                 }
955                 returnAST = declaracion_metodo_AST;
956                 _retTree = _t;
957         }
958         
959         public final void cualificador_elemento_clase(AST _t) throws RecognitionException {
960                 
961                 AST cualificador_elemento_clase_AST_in = (_t == ASTNULL) ? null : (AST)_t;
962                 returnAST = null;
963                 ASTPair currentAST = new ASTPair();
964                 AST cualificador_elemento_clase_AST = null;
965                 
966                 try {      // for error handling
967                         if (_t==null) _t=ASTNULL;
968                         switch ( _t.getType()) {
969                         case OCULTO:
970                         {
971                                 AST tmp10_AST = null;
972                                 AST tmp10_AST_in = null;
973                                 tmp10_AST = astFactory.create((AST)_t);
974                                 tmp10_AST_in = (AST)_t;
975                                 astFactory.addASTChild(currentAST, tmp10_AST);
976                                 match(_t,OCULTO);
977                                 _t = _t.getNextSibling();
978                                 cualificador_elemento_clase_AST = (AST)currentAST.root;
979                                 break;
980                         }
981                         case VISIBLE:
982                         {
983                                 AST tmp11_AST = null;
984                                 AST tmp11_AST_in = null;
985                                 tmp11_AST = astFactory.create((AST)_t);
986                                 tmp11_AST_in = (AST)_t;
987                                 astFactory.addASTChild(currentAST, tmp11_AST);
988                                 match(_t,VISIBLE);
989                                 _t = _t.getNextSibling();
990                                 cualificador_elemento_clase_AST = (AST)currentAST.root;
991                                 break;
992                         }
993                         default:
994                         {
995                                 throw new NoViableAltException(_t);
996                         }
997                         }
998                 }
999                 catch (RecognitionException ex) {
1000                         reportError(ex);
1001                         if (_t!=null) {_t = _t.getNextSibling();}
1002                 }
1003                 returnAST = cualificador_elemento_clase_AST;
1004                 _retTree = _t;
1005         }
1006         
1007         public final void tipo(AST _t) throws RecognitionException {
1008                 
1009                 AST tipo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1010                 returnAST = null;
1011                 ASTPair currentAST = new ASTPair();
1012                 AST tipo_AST = null;
1013                 
1014                 try {      // for error handling
1015                         if (_t==null) _t=ASTNULL;
1016                         switch ( _t.getType()) {
1017                         case ENTERO:
1018                         case REAL:
1019                         case LOGICO:
1020                         case CARACTER:
1021                         {
1022                                 tipo_predefinido_simple(_t);
1023                                 _t = _retTree;
1024                                 astFactory.addASTChild(currentAST, returnAST);
1025                                 tipo_AST = (AST)currentAST.root;
1026                                 break;
1027                         }
1028                         case FORMACION:
1029                         {
1030                                 tipo_predefinido_compuesto(_t);
1031                                 _t = _retTree;
1032                                 astFactory.addASTChild(currentAST, returnAST);
1033                                 tipo_AST = (AST)currentAST.root;
1034                                 break;
1035                         }
1036                         case CLASE:
1037                         {
1038                                 declaracion_clase1(_t);
1039                                 _t = _retTree;
1040                                 astFactory.addASTChild(currentAST, returnAST);
1041                                 tipo_AST = (AST)currentAST.root;
1042                                 break;
1043                         }
1044                         case ERROR:
1045                         {
1046                                 declaracion_error(_t);
1047                                 _t = _retTree;
1048                                 astFactory.addASTChild(currentAST, returnAST);
1049                                 tipo_AST = (AST)currentAST.root;
1050                                 break;
1051                         }
1052                         default:
1053                         {
1054                                 throw new NoViableAltException(_t);
1055                         }
1056                         }
1057                 }
1058                 catch (RecognitionException ex) {
1059                         reportError(ex);
1060                         if (_t!=null) {_t = _t.getNextSibling();}
1061                 }
1062                 returnAST = tipo_AST;
1063                 _retTree = _t;
1064         }
1065         
1066         public final AST  prototipo_metodo(AST _t) throws RecognitionException {
1067                 AST tipodev=null;
1068                 
1069                 AST prototipo_metodo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1070                 returnAST = null;
1071                 ASTPair currentAST = new ASTPair();
1072                 AST prototipo_metodo_AST = null;
1073                 AST t_AST = null;
1074                 AST t = null;
1075                 AST v = null;
1076                 AST v_AST = null;
1077                 
1078                 try {      // for error handling
1079                         AST __t9830 = _t;
1080                         AST tmp12_AST = null;
1081                         AST tmp12_AST_in = null;
1082                         tmp12_AST = astFactory.create((AST)_t);
1083                         tmp12_AST_in = (AST)_t;
1084                         astFactory.addASTChild(currentAST, tmp12_AST);
1085                         ASTPair __currentAST9830 = currentAST.copy();
1086                         currentAST.root = currentAST.child;
1087                         currentAST.child = null;
1088                         match(_t,PROTOTIPO);
1089                         _t = _t.getFirstChild();
1090                         AST tmp13_AST = null;
1091                         AST tmp13_AST_in = null;
1092                         tmp13_AST = astFactory.create((AST)_t);
1093                         tmp13_AST_in = (AST)_t;
1094                         astFactory.addASTChild(currentAST, tmp13_AST);
1095                         match(_t,IDENT);
1096                         _t = _t.getNextSibling();
1097                         AST __t9831 = _t;
1098                         AST tmp14_AST = null;
1099                         AST tmp14_AST_in = null;
1100                         tmp14_AST = astFactory.create((AST)_t);
1101                         tmp14_AST_in = (AST)_t;
1102                         astFactory.addASTChild(currentAST, tmp14_AST);
1103                         ASTPair __currentAST9831 = currentAST.copy();
1104                         currentAST.root = currentAST.child;
1105                         currentAST.child = null;
1106                         match(_t,PARAMETROS);
1107                         _t = _t.getFirstChild();
1108                         declaracion_parametros(_t);
1109                         _t = _retTree;
1110                         astFactory.addASTChild(currentAST, returnAST);
1111                         currentAST = __currentAST9831;
1112                         _t = __t9831;
1113                         _t = _t.getNextSibling();
1114                         AST __t9832 = _t;
1115                         AST tmp15_AST = null;
1116                         AST tmp15_AST_in = null;
1117                         tmp15_AST = astFactory.create((AST)_t);
1118                         tmp15_AST_in = (AST)_t;
1119                         astFactory.addASTChild(currentAST, tmp15_AST);
1120                         ASTPair __currentAST9832 = currentAST.copy();
1121                         currentAST.root = currentAST.child;
1122                         currentAST.child = null;
1123                         match(_t,RESULTADO);
1124                         _t = _t.getFirstChild();
1125                         {
1126                         if (_t==null) _t=ASTNULL;
1127                         switch ( _t.getType()) {
1128                         case ERROR:
1129                         case CLASE:
1130                         case ENTERO:
1131                         case REAL:
1132                         case LOGICO:
1133                         case CARACTER:
1134                         case FORMACION:
1135                         {
1136                                 t = _t==ASTNULL ? null : (AST)_t;
1137                                 tipo(_t);
1138                                 _t = _retTree;
1139                                 t_AST = (AST)returnAST;
1140                                 astFactory.addASTChild(currentAST, returnAST);
1141                                 cont_dev = 0; // inicializa el contador de instrucciones DEV
1142                                 tipodev = t;
1143                                 break;
1144                         }
1145                         case VACIO:
1146                         {
1147                                 v = (AST)_t;
1148                                 AST v_AST_in = null;
1149                                 v_AST = astFactory.create(v);
1150                                 astFactory.addASTChild(currentAST, v_AST);
1151                                 match(_t,VACIO);
1152                                 _t = _t.getNextSibling();
1153                                 cont_dev = -1; // marca a -1 para indicar que es un procedimiento
1154                                 tipodev = v;
1155                                 break;
1156                         }
1157                         default:
1158                         {
1159                                 throw new NoViableAltException(_t);
1160                         }
1161                         }
1162                         }
1163                         currentAST = __currentAST9832;
1164                         _t = __t9832;
1165                         _t = _t.getNextSibling();
1166                         currentAST = __currentAST9830;
1167                         _t = __t9830;
1168                         _t = _t.getNextSibling();
1169                         prototipo_metodo_AST = (AST)currentAST.root;
1170                 }
1171                 catch (RecognitionException ex) {
1172                         reportError(ex);
1173                         if (_t!=null) {_t = _t.getNextSibling();}
1174                 }
1175                 returnAST = prototipo_metodo_AST;
1176                 _retTree = _t;
1177                 return tipodev;
1178         }
1179         
1180         public final void definicion_metodo(AST _t,
1181                 AST tipodev
1182         ) throws RecognitionException {
1183                 
1184                 AST definicion_metodo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1185                 returnAST = null;
1186                 ASTPair currentAST = new ASTPair();
1187                 AST definicion_metodo_AST = null;
1188                 
1189                 try {      // for error handling
1190                         AST __t9840 = _t;
1191                         AST tmp16_AST = null;
1192                         AST tmp16_AST_in = null;
1193                         tmp16_AST = astFactory.create((AST)_t);
1194                         tmp16_AST_in = (AST)_t;
1195                         astFactory.addASTChild(currentAST, tmp16_AST);
1196                         ASTPair __currentAST9840 = currentAST.copy();
1197                         currentAST.root = currentAST.child;
1198                         currentAST.child = null;
1199                         match(_t,DEFINICION);
1200                         _t = _t.getFirstChild();
1201                         AST __t9841 = _t;
1202                         AST tmp17_AST = null;
1203                         AST tmp17_AST_in = null;
1204                         tmp17_AST = astFactory.create((AST)_t);
1205                         tmp17_AST_in = (AST)_t;
1206                         astFactory.addASTChild(currentAST, tmp17_AST);
1207                         ASTPair __currentAST9841 = currentAST.copy();
1208                         currentAST.root = currentAST.child;
1209                         currentAST.child = null;
1210                         match(_t,VARIABLES_LOCALES);
1211                         _t = _t.getFirstChild();
1212                         declaracion_variables_locales(_t);
1213                         _t = _retTree;
1214                         astFactory.addASTChild(currentAST, returnAST);
1215                         currentAST = __currentAST9841;
1216                         _t = __t9841;
1217                         _t = _t.getNextSibling();
1218                         AST __t9842 = _t;
1219                         AST tmp18_AST = null;
1220                         AST tmp18_AST_in = null;
1221                         tmp18_AST = astFactory.create((AST)_t);
1222                         tmp18_AST_in = (AST)_t;
1223                         astFactory.addASTChild(currentAST, tmp18_AST);
1224                         ASTPair __currentAST9842 = currentAST.copy();
1225                         currentAST.root = currentAST.child;
1226                         currentAST.child = null;
1227                         match(_t,INSTRUCCIONES);
1228                         _t = _t.getFirstChild();
1229                         instrucciones(_t,tipodev);
1230                         _t = _retTree;
1231                         astFactory.addASTChild(currentAST, returnAST);
1232                         currentAST = __currentAST9842;
1233                         _t = __t9842;
1234                         _t = _t.getNextSibling();
1235                         currentAST = __currentAST9840;
1236                         _t = __t9840;
1237                         _t = _t.getNextSibling();
1238                         definicion_metodo_AST = (AST)currentAST.root;
1239                 }
1240                 catch (RecognitionException ex) {
1241                         reportError(ex);
1242                         if (_t!=null) {_t = _t.getNextSibling();}
1243                 }
1244                 returnAST = definicion_metodo_AST;
1245                 _retTree = _t;
1246         }
1247         
1248         public final void declaracion_parametros(AST _t) throws RecognitionException {
1249                 
1250                 AST declaracion_parametros_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1251                 returnAST = null;
1252                 ASTPair currentAST = new ASTPair();
1253                 AST declaracion_parametros_AST = null;
1254                 
1255                 try {      // for error handling
1256                         {
1257                         _loop9836:
1258                         do {
1259                                 if (_t==null) _t=ASTNULL;
1260                                 if ((_t.getType()==PARAMETRO)) {
1261                                         declaracion_parametro(_t);
1262                                         _t = _retTree;
1263                                         astFactory.addASTChild(currentAST, returnAST);
1264                                 }
1265                                 else {
1266                                         break _loop9836;
1267                                 }
1268                                 
1269                         } while (true);
1270                         }
1271                         declaracion_parametros_AST = (AST)currentAST.root;
1272                 }
1273                 catch (RecognitionException ex) {
1274                         reportError(ex);
1275                         if (_t!=null) {_t = _t.getNextSibling();}
1276                 }
1277                 returnAST = declaracion_parametros_AST;
1278                 _retTree = _t;
1279         }
1280         
1281         public final void declaracion_parametro(AST _t) throws RecognitionException {
1282                 
1283                 AST declaracion_parametro_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1284                 returnAST = null;
1285                 ASTPair currentAST = new ASTPair();
1286                 AST declaracion_parametro_AST = null;
1287                 
1288                 try {      // for error handling
1289                         AST __t9838 = _t;
1290                         AST tmp19_AST = null;
1291                         AST tmp19_AST_in = null;
1292                         tmp19_AST = astFactory.create((AST)_t);
1293                         tmp19_AST_in = (AST)_t;
1294                         astFactory.addASTChild(currentAST, tmp19_AST);
1295                         ASTPair __currentAST9838 = currentAST.copy();
1296                         currentAST.root = currentAST.child;
1297                         currentAST.child = null;
1298                         match(_t,PARAMETRO);
1299                         _t = _t.getFirstChild();
1300                         AST tmp20_AST = null;
1301                         AST tmp20_AST_in = null;
1302                         tmp20_AST = astFactory.create((AST)_t);
1303                         tmp20_AST_in = (AST)_t;
1304                         astFactory.addASTChild(currentAST, tmp20_AST);
1305                         match(_t,IDENT);
1306                         _t = _t.getNextSibling();
1307                         tipo(_t);
1308                         _t = _retTree;
1309                         astFactory.addASTChild(currentAST, returnAST);
1310                         currentAST = __currentAST9838;
1311                         _t = __t9838;
1312                         _t = _t.getNextSibling();
1313                         declaracion_parametro_AST = (AST)currentAST.root;
1314                 }
1315                 catch (RecognitionException ex) {
1316                         reportError(ex);
1317                         if (_t!=null) {_t = _t.getNextSibling();}
1318                 }
1319                 returnAST = declaracion_parametro_AST;
1320                 _retTree = _t;
1321         }
1322         
1323         public final void declaracion_variables_locales(AST _t) throws RecognitionException {
1324                 
1325                 AST declaracion_variables_locales_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1326                 returnAST = null;
1327                 ASTPair currentAST = new ASTPair();
1328                 AST declaracion_variables_locales_AST = null;
1329                 
1330                 try {      // for error handling
1331                         {
1332                         _loop9845:
1333                         do {
1334                                 if (_t==null) _t=ASTNULL;
1335                                 if ((_t.getType()==VARIABLE_LOCAL)) {
1336                                         declaracion_variable_local(_t);
1337                                         _t = _retTree;
1338                                         astFactory.addASTChild(currentAST, returnAST);
1339                                 }
1340                                 else {
1341                                         break _loop9845;
1342                                 }
1343                                 
1344                         } while (true);
1345                         }
1346                         declaracion_variables_locales_AST = (AST)currentAST.root;
1347                 }
1348                 catch (RecognitionException ex) {
1349                         reportError(ex);
1350                         if (_t!=null) {_t = _t.getNextSibling();}
1351                 }
1352                 returnAST = declaracion_variables_locales_AST;
1353                 _retTree = _t;
1354         }
1355         
1356         public final void instrucciones(AST _t,
1357                 AST tipodev
1358         ) throws RecognitionException {
1359                 
1360                 AST instrucciones_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1361                 returnAST = null;
1362                 ASTPair currentAST = new ASTPair();
1363                 AST instrucciones_AST = null;
1364                 
1365                 try {      // for error handling
1366                         {
1367                         _loop9851:
1368                         do {
1369                                 if (_t==null) _t=ASTNULL;
1370                                 if ((_t.getType()==INSTRUCCION)) {
1371                                         instruccion(_t,tipodev);
1372                                         _t = _retTree;
1373                                         astFactory.addASTChild(currentAST, returnAST);
1374                                 }
1375                                 else {
1376                                         break _loop9851;
1377                                 }
1378                                 
1379                         } while (true);
1380                         }
1381                         instrucciones_AST = (AST)currentAST.root;
1382                 }
1383                 catch (RecognitionException ex) {
1384                         reportError(ex);
1385                         if (_t!=null) {_t = _t.getNextSibling();}
1386                 }
1387                 returnAST = instrucciones_AST;
1388                 _retTree = _t;
1389         }
1390         
1391         public final void declaracion_variable_local(AST _t) throws RecognitionException {
1392                 
1393                 AST declaracion_variable_local_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1394                 returnAST = null;
1395                 ASTPair currentAST = new ASTPair();
1396                 AST declaracion_variable_local_AST = null;
1397                 
1398                 try {      // for error handling
1399                         AST __t9847 = _t;
1400                         AST tmp21_AST = null;
1401                         AST tmp21_AST_in = null;
1402                         tmp21_AST = astFactory.create((AST)_t);
1403                         tmp21_AST_in = (AST)_t;
1404                         astFactory.addASTChild(currentAST, tmp21_AST);
1405                         ASTPair __currentAST9847 = currentAST.copy();
1406                         currentAST.root = currentAST.child;
1407                         currentAST.child = null;
1408                         match(_t,VARIABLE_LOCAL);
1409                         _t = _t.getFirstChild();
1410                         AST tmp22_AST = null;
1411                         AST tmp22_AST_in = null;
1412                         tmp22_AST = astFactory.create((AST)_t);
1413                         tmp22_AST_in = (AST)_t;
1414                         astFactory.addASTChild(currentAST, tmp22_AST);
1415                         match(_t,IDENT);
1416                         _t = _t.getNextSibling();
1417                         tipo(_t);
1418                         _t = _retTree;
1419                         astFactory.addASTChild(currentAST, returnAST);
1420                         currentAST = __currentAST9847;
1421                         _t = __t9847;
1422                         _t = _t.getNextSibling();
1423                         declaracion_variable_local_AST = (AST)currentAST.root;
1424                 }
1425                 catch (RecognitionException ex) {
1426                         reportError(ex);
1427                         if (_t!=null) {_t = _t.getNextSibling();}
1428                 }
1429                 returnAST = declaracion_variable_local_AST;
1430                 _retTree = _t;
1431         }
1432         
1433         public final void declaracion_error(AST _t) throws RecognitionException {
1434                 
1435                 AST declaracion_error_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1436                 returnAST = null;
1437                 ASTPair currentAST = new ASTPair();
1438                 AST declaracion_error_AST = null;
1439                 
1440                 try {      // for error handling
1441                         AST tmp23_AST = null;
1442                         AST tmp23_AST_in = null;
1443                         tmp23_AST = astFactory.create((AST)_t);
1444                         tmp23_AST_in = (AST)_t;
1445                         astFactory.addASTChild(currentAST, tmp23_AST);
1446                         match(_t,ERROR);
1447                         _t = _t.getNextSibling();
1448                         declaracion_error_AST = (AST)currentAST.root;
1449                 }
1450                 catch (RecognitionException ex) {
1451                         reportError(ex);
1452                         if (_t!=null) {_t = _t.getNextSibling();}
1453                 }
1454                 returnAST = declaracion_error_AST;
1455                 _retTree = _t;
1456         }
1457         
1458         public final void instruccion(AST _t,
1459                 AST tipodev
1460         ) throws RecognitionException {
1461                 
1462                 AST instruccion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1463                 returnAST = null;
1464                 ASTPair currentAST = new ASTPair();
1465                 AST instruccion_AST = null;
1466                 
1467                 try {      // for error handling
1468                         AST __t9853 = _t;
1469                         AST tmp24_AST = null;
1470                         AST tmp24_AST_in = null;
1471                         tmp24_AST = astFactory.create((AST)_t);
1472                         tmp24_AST_in = (AST)_t;
1473                         astFactory.addASTChild(currentAST, tmp24_AST);
1474                         ASTPair __currentAST9853 = currentAST.copy();
1475                         currentAST.root = currentAST.child;
1476                         currentAST.child = null;
1477                         match(_t,INSTRUCCION);
1478                         _t = _t.getFirstChild();
1479                         {
1480                         if (_t==null) _t=ASTNULL;
1481                         switch ( _t.getType()) {
1482                         case LLAMADA:
1483                         case DEV:
1484                         case ASIGNACION:
1485                         case CREAR:
1486                         case ESCRIBIR:
1487                         {
1488                                 instruccion_simple(_t,tipodev);
1489                                 _t = _retTree;
1490                                 astFactory.addASTChild(currentAST, returnAST);
1491                                 break;
1492                         }
1493                         case SI:
1494                         case MIENTRAS:
1495                         {
1496                                 instruccion_compuesta(_t,tipodev);
1497                                 _t = _retTree;
1498                                 astFactory.addASTChild(currentAST, returnAST);
1499                                 break;
1500                         }
1501                         default:
1502                         {
1503                                 throw new NoViableAltException(_t);
1504                         }
1505                         }
1506                         }
1507                         currentAST = __currentAST9853;
1508                         _t = __t9853;
1509                         _t = _t.getNextSibling();
1510                         instruccion_AST = (AST)currentAST.root;
1511                 }
1512                 catch (RecognitionException ex) {
1513                         reportError(ex);
1514                         if (_t!=null) {_t = _t.getNextSibling();}
1515                 }
1516                 returnAST = instruccion_AST;
1517                 _retTree = _t;
1518         }
1519         
1520         public final void instruccion_simple(AST _t,
1521                 AST tipodev
1522         ) throws RecognitionException {
1523                 
1524                 AST instruccion_simple_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1525                 returnAST = null;
1526                 ASTPair currentAST = new ASTPair();
1527                 AST instruccion_simple_AST = null;
1528                 
1529                 try {      // for error handling
1530                         if (_t==null) _t=ASTNULL;
1531                         switch ( _t.getType()) {
1532                         case CREAR:
1533                         {
1534                                 crear(_t);
1535                                 _t = _retTree;
1536                                 astFactory.addASTChild(currentAST, returnAST);
1537                                 instruccion_simple_AST = (AST)currentAST.root;
1538                                 break;
1539                         }
1540                         case LLAMADA:
1541                         {
1542                                 llamada_metodo(_t);
1543                                 _t = _retTree;
1544                                 astFactory.addASTChild(currentAST, returnAST);
1545                                 instruccion_simple_AST = (AST)currentAST.root;
1546                                 break;
1547                         }
1548                         case ESCRIBIR:
1549                         {
1550                                 escribir(_t);
1551                                 _t = _retTree;
1552                                 astFactory.addASTChild(currentAST, returnAST);
1553                                 instruccion_simple_AST = (AST)currentAST.root;
1554                                 break;
1555                         }
1556                         case ASIGNACION:
1557                         {
1558                                 asignacion(_t);
1559                                 _t = _retTree;
1560                                 astFactory.addASTChild(currentAST, returnAST);
1561                                 instruccion_simple_AST = (AST)currentAST.root;
1562                                 break;
1563                         }
1564                         case DEV:
1565                         {
1566                                 retorno(_t,tipodev);
1567                                 _t = _retTree;
1568                                 astFactory.addASTChild(currentAST, returnAST);
1569                                 instruccion_simple_AST = (AST)currentAST.root;
1570                                 break;
1571                         }
1572                         default:
1573                         {
1574                                 throw new NoViableAltException(_t);
1575                         }
1576                         }
1577                 }
1578                 catch (RecognitionException ex) {
1579                         reportError(ex);
1580                         if (_t!=null) {_t = _t.getNextSibling();}
1581                 }
1582                 returnAST = instruccion_simple_AST;
1583                 _retTree = _t;
1584         }
1585         
1586         public final void instruccion_compuesta(AST _t,
1587                 AST tipodev
1588         ) throws RecognitionException {
1589                 
1590                 AST instruccion_compuesta_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1591                 returnAST = null;
1592                 ASTPair currentAST = new ASTPair();
1593                 AST instruccion_compuesta_AST = null;
1594                 
1595                 try {      // for error handling
1596                         if (_t==null) _t=ASTNULL;
1597                         switch ( _t.getType()) {
1598                         case SI:
1599                         {
1600                                 condicion(_t,tipodev);
1601                                 _t = _retTree;
1602                                 astFactory.addASTChild(currentAST, returnAST);
1603                                 instruccion_compuesta_AST = (AST)currentAST.root;
1604                                 break;
1605                         }
1606                         case MIENTRAS:
1607                         {
1608                                 iteracion(_t,tipodev);
1609                                 _t = _retTree;
1610                                 astFactory.addASTChild(currentAST, returnAST);
1611                                 instruccion_compuesta_AST = (AST)currentAST.root;
1612                                 break;
1613                         }
1614                         default:
1615                         {
1616                                 throw new NoViableAltException(_t);
1617                         }
1618                         }
1619                 }
1620                 catch (RecognitionException ex) {
1621                         reportError(ex);
1622                         if (_t!=null) {_t = _t.getNextSibling();}
1623                 }
1624                 returnAST = instruccion_compuesta_AST;
1625                 _retTree = _t;
1626         }
1627         
1628         public final void crear(AST _t) throws RecognitionException {
1629                 
1630                 AST crear_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1631                 returnAST = null;
1632                 ASTPair currentAST = new ASTPair();
1633                 AST crear_AST = null;
1634                 AST e2_AST = null;
1635                 AST e2 = null;
1636                 Atr_Expr e1;
1637                 
1638                 try {      // for error handling
1639                         AST __t9857 = _t;
1640                         AST tmp25_AST = null;
1641                         AST tmp25_AST_in = null;
1642                         tmp25_AST = astFactory.create((AST)_t);
1643                         tmp25_AST_in = (AST)_t;
1644                         astFactory.addASTChild(currentAST, tmp25_AST);
1645                         ASTPair __currentAST9857 = currentAST.copy();
1646                         currentAST.root = currentAST.child;
1647                         currentAST.child = null;
1648                         match(_t,CREAR);
1649                         _t = _t.getFirstChild();
1650                         e1=expresion(_t);
1651                         _t = _retTree;
1652                         astFactory.addASTChild(currentAST, returnAST);
1653                         e2 = _t==ASTNULL ? null : (AST)_t;
1654                         expresion(_t);
1655                         _t = _retTree;
1656                         e2_AST = (AST)returnAST;
1657                         astFactory.addASTChild(currentAST, returnAST);
1658                         currentAST = __currentAST9857;
1659                         _t = __t9857;
1660                         _t = _t.getNextSibling();
1661                         AS_Crear(e1,e2_AST);
1662                         crear_AST = (AST)currentAST.root;
1663                 }
1664                 catch (RecognitionException ex) {
1665                         reportError(ex);
1666                         if (_t!=null) {_t = _t.getNextSibling();}
1667                 }
1668                 returnAST = crear_AST;
1669                 _retTree = _t;
1670         }
1671         
1672         public final void llamada_metodo(AST _t) throws RecognitionException {
1673                 
1674                 AST llamada_metodo_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1675                 returnAST = null;
1676                 ASTPair currentAST = new ASTPair();
1677                 AST llamada_metodo_AST = null;
1678                 Atr_Expr a, res; LinkedList l;
1679                 
1680                 try {      // for error handling
1681                         AST __t9866 = _t;
1682                         AST tmp26_AST = null;
1683                         AST tmp26_AST_in = null;
1684                         tmp26_AST = astFactory.create((AST)_t);
1685                         tmp26_AST_in = (AST)_t;
1686                         astFactory.addASTChild(currentAST, tmp26_AST);
1687                         ASTPair __currentAST9866 = currentAST.copy();
1688                         currentAST.root = currentAST.child;
1689                         currentAST.child = null;
1690                         match(_t,LLAMADA);
1691                         _t = _t.getFirstChild();
1692                         a=acceso(_t);
1693                         _t = _retTree;
1694                         astFactory.addASTChild(currentAST, returnAST);
1695                         AST __t9867 = _t;
1696                         AST tmp27_AST = null;
1697                         AST tmp27_AST_in = null;
1698                         tmp27_AST = astFactory.create((AST)_t);
1699                         tmp27_AST_in = (AST)_t;
1700                         astFactory.addASTChild(currentAST, tmp27_AST);
1701                         ASTPair __currentAST9867 = currentAST.copy();
1702                         currentAST.root = currentAST.child;
1703                         currentAST.child = null;
1704                         match(_t,EXPRESIONES);
1705                         _t = _t.getFirstChild();
1706                         l=lista_expresiones(_t);
1707                         _t = _retTree;
1708                         astFactory.addASTChild(currentAST, returnAST);
1709                         currentAST = __currentAST9867;
1710                         _t = __t9867;
1711                         _t = _t.getNextSibling();
1712                         currentAST = __currentAST9866;
1713                         _t = __t9866;
1714                         _t = _t.getNextSibling();
1715                         res=AS_Llamada(a,l);
1716                         if (res != null && res.getTipo().getType() != VACIO){
1717                                 System.out.println("ERROR: Llamada a funcion sin asignar valor devuelto.");
1718                                 System.exit(1); 
1719                         } 
1720                         
1721                         llamada_metodo_AST = (AST)currentAST.root;
1722                 }
1723                 catch (RecognitionException ex) {
1724                         reportError(ex);
1725                         if (_t!=null) {_t = _t.getNextSibling();}
1726                 }
1727                 returnAST = llamada_metodo_AST;
1728                 _retTree = _t;
1729         }
1730         
1731         public final void escribir(AST _t) throws RecognitionException {
1732                 
1733                 AST escribir_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1734                 returnAST = null;
1735                 ASTPair currentAST = new ASTPair();
1736                 AST escribir_AST = null;
1737                 AST e_AST = null;
1738                 AST e = null;
1739                 Atr_Expr e1;
1740                 
1741                 try {      // for error handling
1742                         AST __t9859 = _t;
1743                         AST tmp28_AST = null;
1744                         AST tmp28_AST_in = null;
1745                         tmp28_AST = astFactory.create((AST)_t);
1746                         tmp28_AST_in = (AST)_t;
1747                         astFactory.addASTChild(currentAST, tmp28_AST);
1748                         ASTPair __currentAST9859 = currentAST.copy();
1749                         currentAST.root = currentAST.child;
1750                         currentAST.child = null;
1751                         match(_t,ESCRIBIR);
1752                         _t = _t.getFirstChild();
1753                         e = _t==ASTNULL ? null : (AST)_t;
1754                         e1=expresion(_t);
1755                         _t = _retTree;
1756                         e_AST = (AST)returnAST;
1757                         astFactory.addASTChild(currentAST, returnAST);
1758                         currentAST = __currentAST9859;
1759                         _t = __t9859;
1760                         _t = _t.getNextSibling();
1761                         AS_Escribir(e1, e_AST);
1762                         escribir_AST = (AST)currentAST.root;
1763                 }
1764                 catch (RecognitionException ex) {
1765                         reportError(ex);
1766                         if (_t!=null) {_t = _t.getNextSibling();}
1767                 }
1768                 returnAST = escribir_AST;
1769                 _retTree = _t;
1770         }
1771         
1772         public final void asignacion(AST _t) throws RecognitionException {
1773                 
1774                 AST asignacion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1775                 returnAST = null;
1776                 ASTPair currentAST = new ASTPair();
1777                 AST asignacion_AST = null;
1778                 AST e3_AST = null;
1779                 AST e3 = null;
1780                 AST e4_AST = null;
1781                 AST e4 = null;
1782                 Atr_Expr e1, e2;
1783                 
1784                 try {      // for error handling
1785                         AST __t9862 = _t;
1786                         AST tmp29_AST = null;
1787                         AST tmp29_AST_in = null;
1788                         tmp29_AST = astFactory.create((AST)_t);
1789                         tmp29_AST_in = (AST)_t;
1790                         astFactory.addASTChild(currentAST, tmp29_AST);
1791                         ASTPair __currentAST9862 = currentAST.copy();
1792                         currentAST.root = currentAST.child;
1793                         currentAST.child = null;
1794                         match(_t,ASIGNACION);
1795                         _t = _t.getFirstChild();
1796                         e3 = _t==ASTNULL ? null : (AST)_t;
1797                         e1=expresion(_t);
1798                         _t = _retTree;
1799                         e3_AST = (AST)returnAST;
1800                         astFactory.addASTChild(currentAST, returnAST);
1801                         e4 = _t==ASTNULL ? null : (AST)_t;
1802                         e2=expresion(_t);
1803                         _t = _retTree;
1804                         e4_AST = (AST)returnAST;
1805                         astFactory.addASTChild(currentAST, returnAST);
1806                         currentAST = __currentAST9862;
1807                         _t = __t9862;
1808                         _t = _t.getNextSibling();
1809                                 AS_Asignacion(e1,e2,e3_AST,e4_AST);
1810                         
1811                         asignacion_AST = (AST)currentAST.root;
1812                 }
1813                 catch (RecognitionException ex) {
1814                         reportError(ex);
1815                         if (_t!=null) {_t = _t.getNextSibling();}
1816                 }
1817                 returnAST = asignacion_AST;
1818                 _retTree = _t;
1819         }
1820         
1821         public final void retorno(AST _t,
1822                 AST tipodev
1823         ) throws RecognitionException {
1824                 
1825                 AST retorno_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1826                 returnAST = null;
1827                 ASTPair currentAST = new ASTPair();
1828                 AST retorno_AST = null;
1829                 Atr_Expr e;
1830                 
1831                 try {      // for error handling
1832                         AST __t9864 = _t;
1833                         AST tmp30_AST = null;
1834                         AST tmp30_AST_in = null;
1835                         tmp30_AST = astFactory.create((AST)_t);
1836                         tmp30_AST_in = (AST)_t;
1837                         astFactory.addASTChild(currentAST, tmp30_AST);
1838                         ASTPair __currentAST9864 = currentAST.copy();
1839                         currentAST.root = currentAST.child;
1840                         currentAST.child = null;
1841                         match(_t,DEV);
1842                         _t = _t.getFirstChild();
1843                         e=expresion(_t);
1844                         _t = _retTree;
1845                         astFactory.addASTChild(currentAST, returnAST);
1846                         currentAST = __currentAST9864;
1847                         _t = __t9864;
1848                         _t = _t.getNextSibling();
1849                         /*AS_Devolucion(tipodev, e);
1850                         cont_dev++;*/
1851                         cont_dev=AS_Devolucion(tipodev,e,cont_dev);
1852                         
1853                         retorno_AST = (AST)currentAST.root;
1854                 }
1855                 catch (RecognitionException ex) {
1856                         reportError(ex);
1857                         if (_t!=null) {_t = _t.getNextSibling();}
1858                 }
1859                 returnAST = retorno_AST;
1860                 _retTree = _t;
1861         }
1862         
1863         public final Atr_Expr  expresion(AST _t) throws RecognitionException {
1864                 Atr_Expr res=null;
1865                 
1866                 AST expresion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
1867                 returnAST = null;
1868                 ASTPair currentAST = new ASTPair();
1869                 AST expresion_AST = null;
1870                 AST op1 = null;
1871                 AST op1_AST = null;
1872                 AST op2 = null;
1873                 AST op2_AST = null;
1874                 AST op3 = null;
1875                 AST op3_AST = null;
1876                 AST op4 = null;
1877                 AST op4_AST = null;
1878                 AST op5 = null;
1879                 AST op5_AST = null;
1880                 AST op6 = null;
1881                 AST op6_AST = null;
1882                 AST i = null;
1883                 AST i_AST = null;
1884                 AST j = null;
1885                 AST j_AST = null;
1886                 AST k = null;
1887                 AST k_AST = null;
1888                 AST m = null;
1889                 AST m_AST = null;
1890                 AST n = null;
1891                 AST n_AST = null;
1892                 Atr_Expr e1,e2; LinkedList l;
1893                 
1894                 try {      // for error handling
1895                         if (_t==null) _t=ASTNULL;
1896                         switch ( _t.getType()) {
1897                         case O:
1898                         {
1899                                 AST __t9880 = _t;
1900                                 AST tmp31_AST = null;
1901                                 AST tmp31_AST_in = null;
1902                                 tmp31_AST = astFactory.create((AST)_t);
1903                                 tmp31_AST_in = (AST)_t;
1904                                 astFactory.addASTChild(currentAST, tmp31_AST);
1905                                 ASTPair __currentAST9880 = currentAST.copy();
1906                                 currentAST.root = currentAST.child;
1907                                 currentAST.child = null;
1908                                 match(_t,O);
1909                                 _t = _t.getFirstChild();
1910                                 e1=expresion(_t);
1911                                 _t = _retTree;
1912                                 astFactory.addASTChild(currentAST, returnAST);
1913                                 e2=expresion(_t);
1914                                 _t = _retTree;
1915                                 astFactory.addASTChild(currentAST, returnAST);
1916                                 currentAST = __currentAST9880;
1917                                 _t = __t9880;
1918                                 _t = _t.getNextSibling();
1919                                 res=AS_Exp_Bin_Log( e1, e2);
1920                                 
1921                                 expresion_AST = (AST)currentAST.root;
1922                                 break;
1923                         }
1924                         case Y:
1925                         {
1926                                 AST __t9881 = _t;
1927                                 AST tmp32_AST = null;
1928                                 AST tmp32_AST_in = null;
1929                                 tmp32_AST = astFactory.create((AST)_t);
1930                                 tmp32_AST_in = (AST)_t;
1931                                 astFactory.addASTChild(currentAST, tmp32_AST);
1932                                 ASTPair __currentAST9881 = currentAST.copy();
1933                                 currentAST.root = currentAST.child;
1934                                 currentAST.child = null;
1935                                 match(_t,Y);
1936                                 _t = _t.getFirstChild();
1937                                 e1=expresion(_t);
1938                                 _t = _retTree;
1939                                 astFactory.addASTChild(currentAST, returnAST);
1940                                 e2=expresion(_t);
1941                                 _t = _retTree;
1942                                 astFactory.addASTChild(currentAST, returnAST);
1943                                 currentAST = __currentAST9881;
1944                                 _t = __t9881;
1945                                 _t = _t.getNextSibling();
1946                                 res=AS_Exp_Bin_Log( e1, e2);
1947                                 
1948                                 expresion_AST = (AST)currentAST.root;
1949                                 break;
1950                         }
1951                         case NO:
1952                         {
1953                                 AST __t9882 = _t;
1954                                 AST tmp33_AST = null;
1955                                 AST tmp33_AST_in = null;
1956                                 tmp33_AST = astFactory.create((AST)_t);
1957                                 tmp33_AST_in = (AST)_t;
1958                                 astFactory.addASTChild(currentAST, tmp33_AST);
1959                                 ASTPair __currentAST9882 = currentAST.copy();
1960                                 currentAST.root = currentAST.child;
1961                                 currentAST.child = null;
1962                                 match(_t,NO);
1963                                 _t = _t.getFirstChild();
1964                                 e1=expresion(_t);
1965                                 _t = _retTree;
1966                                 astFactory.addASTChild(currentAST, returnAST);
1967                                 currentAST = __currentAST9882;
1968                                 _t = __t9882;
1969                                 _t = _t.getNextSibling();
1970                                 res=AS_Exp_Una_Log( e1);
1971                                 
1972                                 expresion_AST = (AST)currentAST.root;
1973                                 break;
1974                         }
1975                         case MAYOR:
1976                         {
1977                                 AST __t9883 = _t;
1978                                 op1 = _t==ASTNULL ? null :(AST)_t;
1979                                 AST op1_AST_in = null;
1980                                 op1_AST = astFactory.create(op1);
1981                                 astFactory.addASTChild(currentAST, op1_AST);
1982                                 ASTPair __currentAST9883 = currentAST.copy();
1983                                 currentAST.root = currentAST.child;
1984                                 currentAST.child = null;
1985                                 match(_t,MAYOR);
1986                                 _t = _t.getFirstChild();
1987                                 e1=expresion(_t);
1988                                 _t = _retTree;
1989                                 astFactory.addASTChild(currentAST, returnAST);
1990                                 e2=expresion(_t);
1991                                 _t = _retTree;
1992                                 astFactory.addASTChild(currentAST, returnAST);
1993                                 currentAST = __currentAST9883;
1994                                 _t = __t9883;
1995                                 _t = _t.getNextSibling();
1996                                 res=AS_Exp_Bin_Rel( e1, e2, op1);
1997                                 
1998                                 expresion_AST = (AST)currentAST.root;
1999                                 break;
2000                         }
2001                         case MAYOR_IGUAL:
2002                         {
2003                                 AST __t9884 = _t;
2004                                 op2 = _t==ASTNULL ? null :(AST)_t;
2005                                 AST op2_AST_in = null;
2006                                 op2_AST = astFactory.create(op2);
2007                                 astFactory.addASTChild(currentAST, op2_AST);
2008                                 ASTPair __currentAST9884 = currentAST.copy();
2009                                 currentAST.root = currentAST.child;
2010                                 currentAST.child = null;
2011                                 match(_t,MAYOR_IGUAL);
2012                                 _t = _t.getFirstChild();
2013                                 e1=expresion(_t);
2014                                 _t = _retTree;
2015                                 astFactory.addASTChild(currentAST, returnAST);
2016                                 e2=expresion(_t);
2017                                 _t = _retTree;
2018                                 astFactory.addASTChild(currentAST, returnAST);
2019                                 currentAST = __currentAST9884;
2020                                 _t = __t9884;
2021                                 _t = _t.getNextSibling();
2022                                 res=AS_Exp_Bin_Rel( e1, e2, op2);
2023                                 
2024                                 expresion_AST = (AST)currentAST.root;
2025                                 break;
2026                         }
2027                         case MENOR:
2028                         {
2029                                 AST __t9885 = _t;
2030                                 op3 = _t==ASTNULL ? null :(AST)_t;
2031                                 AST op3_AST_in = null;
2032                                 op3_AST = astFactory.create(op3);
2033                                 astFactory.addASTChild(currentAST, op3_AST);
2034                                 ASTPair __currentAST9885 = currentAST.copy();
2035                                 currentAST.root = currentAST.child;
2036                                 currentAST.child = null;
2037                                 match(_t,MENOR);
2038                                 _t = _t.getFirstChild();
2039                                 e1=expresion(_t);
2040                                 _t = _retTree;
2041                                 astFactory.addASTChild(currentAST, returnAST);
2042                                 e2=expresion(_t);
2043                                 _t = _retTree;
2044                                 astFactory.addASTChild(currentAST, returnAST);
2045                                 currentAST = __currentAST9885;
2046                                 _t = __t9885;
2047                                 _t = _t.getNextSibling();
2048                                 res=AS_Exp_Bin_Rel( e1, e2, op3);
2049                                 
2050                                 expresion_AST = (AST)currentAST.root;
2051                                 break;
2052                         }
2053                         case MENOR_IGUAL:
2054                         {
2055                                 AST __t9886 = _t;
2056                                 op4 = _t==ASTNULL ? null :(AST)_t;
2057                                 AST op4_AST_in = null;
2058                                 op4_AST = astFactory.create(op4);
2059                                 astFactory.addASTChild(currentAST, op4_AST);
2060                                 ASTPair __currentAST9886 = currentAST.copy();
2061                                 currentAST.root = currentAST.child;
2062                                 currentAST.child = null;
2063                                 match(_t,MENOR_IGUAL);
2064                                 _t = _t.getFirstChild();
2065                                 e1=expresion(_t);
2066                                 _t = _retTree;
2067                                 astFactory.addASTChild(currentAST, returnAST);
2068                                 e2=expresion(_t);
2069                                 _t = _retTree;
2070                                 astFactory.addASTChild(currentAST, returnAST);
2071                                 currentAST = __currentAST9886;
2072                                 _t = __t9886;
2073                                 _t = _t.getNextSibling();
2074                                 res=AS_Exp_Bin_Rel( e1, e2, op4);
2075                                 
2076                                 expresion_AST = (AST)currentAST.root;
2077                                 break;
2078                         }
2079                         case IGUAL:
2080                         {
2081                                 AST __t9887 = _t;
2082                                 op5 = _t==ASTNULL ? null :(AST)_t;
2083                                 AST op5_AST_in = null;
2084                                 op5_AST = astFactory.create(op5);
2085                                 astFactory.addASTChild(currentAST, op5_AST);
2086                                 ASTPair __currentAST9887 = currentAST.copy();
2087                                 currentAST.root = currentAST.child;
2088                                 currentAST.child = null;
2089                                 match(_t,IGUAL);
2090                                 _t = _t.getFirstChild();
2091                                 e1=expresion(_t);
2092                                 _t = _retTree;
2093                                 astFactory.addASTChild(currentAST, returnAST);
2094                                 e2=expresion(_t);
2095                                 _t = _retTree;
2096                                 astFactory.addASTChild(currentAST, returnAST);
2097                                 currentAST = __currentAST9887;
2098                                 _t = __t9887;
2099                                 _t = _t.getNextSibling();
2100                                 res=AS_Exp_Bin_Rel( e1, e2, op5);
2101                                 
2102                                 expresion_AST = (AST)currentAST.root;
2103                                 break;
2104                         }
2105                         case DISTINTO:
2106                         {
2107                                 AST __t9888 = _t;
2108                                 op6 = _t==ASTNULL ? null :(AST)_t;
2109                                 AST op6_AST_in = null;
2110                                 op6_AST = astFactory.create(op6);
2111                                 astFactory.addASTChild(currentAST, op6_AST);
2112                                 ASTPair __currentAST9888 = currentAST.copy();
2113                                 currentAST.root = currentAST.child;
2114                                 currentAST.child = null;
2115                                 match(_t,DISTINTO);
2116                                 _t = _t.getFirstChild();
2117                                 e1=expresion(_t);
2118                                 _t = _retTree;
2119                                 astFactory.addASTChild(currentAST, returnAST);
2120                                 e2=expresion(_t);
2121                                 _t = _retTree;
2122                                 astFactory.addASTChild(currentAST, returnAST);
2123                                 currentAST = __currentAST9888;
2124                                 _t = __t9888;
2125                                 _t = _t.getNextSibling();
2126                                 res=AS_Exp_Bin_Rel( e1, e2, op6);
2127                                 
2128                                 expresion_AST = (AST)currentAST.root;
2129                                 break;
2130                         }
2131                         case MAS:
2132                         {
2133                                 AST __t9889 = _t;
2134                                 AST tmp34_AST = null;
2135                                 AST tmp34_AST_in = null;
2136                                 tmp34_AST = astFactory.create((AST)_t);
2137                                 tmp34_AST_in = (AST)_t;
2138                                 astFactory.addASTChild(currentAST, tmp34_AST);
2139                                 ASTPair __currentAST9889 = currentAST.copy();
2140                                 currentAST.root = currentAST.child;
2141                                 currentAST.child = null;
2142                                 match(_t,MAS);
2143                                 _t = _t.getFirstChild();
2144                                 e1=expresion(_t);
2145                                 _t = _retTree;
2146                                 astFactory.addASTChild(currentAST, returnAST);
2147                                 e2=expresion(_t);
2148                                 _t = _retTree;
2149                                 astFactory.addASTChild(currentAST, returnAST);
2150                                 currentAST = __currentAST9889;
2151                                 _t = __t9889;
2152                                 _t = _t.getNextSibling();
2153                                 res=AS_Exp_Bin_Arit( e1, e2);
2154                                 
2155                                 expresion_AST = (AST)currentAST.root;
2156                                 break;
2157                         }
2158                         case MENOS:
2159                         {
2160                                 AST __t9890 = _t;
2161                                 AST tmp35_AST = null;
2162                                 AST tmp35_AST_in = null;
2163                                 tmp35_AST = astFactory.create((AST)_t);
2164                                 tmp35_AST_in = (AST)_t;
2165                                 astFactory.addASTChild(currentAST, tmp35_AST);
2166                                 ASTPair __currentAST9890 = currentAST.copy();
2167                                 currentAST.root = currentAST.child;
2168                                 currentAST.child = null;
2169                                 match(_t,MENOS);
2170                                 _t = _t.getFirstChild();
2171                                 e1=expresion(_t);
2172                                 _t = _retTree;
2173                                 astFactory.addASTChild(currentAST, returnAST);
2174                                 e2=expresion(_t);
2175                                 _t = _retTree;
2176                                 astFactory.addASTChild(currentAST, returnAST);
2177                                 currentAST = __currentAST9890;
2178                                 _t = __t9890;
2179                                 _t = _t.getNextSibling();
2180                                 res=AS_Exp_Bin_Arit( e1, e2);
2181                                 
2182                                 expresion_AST = (AST)currentAST.root;
2183                                 break;
2184                         }
2185                         case MENOSUNARIO:
2186                         {
2187                                 AST __t9891 = _t;
2188                                 AST tmp36_AST = null;
2189                                 AST tmp36_AST_in = null;
2190                                 tmp36_AST = astFactory.create((AST)_t);
2191                                 tmp36_AST_in = (AST)_t;
2192                                 astFactory.addASTChild(currentAST, tmp36_AST);
2193                                 ASTPair __currentAST9891 = currentAST.copy();
2194                                 currentAST.root = currentAST.child;
2195                                 currentAST.child = null;
2196                                 match(_t,MENOSUNARIO);
2197                                 _t = _t.getFirstChild();
2198                                 e1=expresion(_t);
2199                                 _t = _retTree;
2200                                 astFactory.addASTChild(currentAST, returnAST);
2201                                 currentAST = __currentAST9891;
2202                                 _t = __t9891;
2203                                 _t = _t.getNextSibling();
2204                                 res=AS_Exp_Una_Arit( e1);
2205                                 
2206                                 expresion_AST = (AST)currentAST.root;
2207                                 break;
2208                         }
2209                         case POR:
2210                         {
2211                                 AST __t9892 = _t;
2212                                 AST tmp37_AST = null;
2213                                 AST tmp37_AST_in = null;
2214                                 tmp37_AST = astFactory.create((AST)_t);
2215                                 tmp37_AST_in = (AST)_t;
2216                                 astFactory.addASTChild(currentAST, tmp37_AST);
2217                                 ASTPair __currentAST9892 = currentAST.copy();
2218                                 currentAST.root = currentAST.child;
2219                                 currentAST.child = null;
2220                                 match(_t,POR);
2221                                 _t = _t.getFirstChild();
2222                                 e1=expresion(_t);
2223                                 _t = _retTree;
2224                                 astFactory.addASTChild(currentAST, returnAST);
2225                                 e2=expresion(_t);
2226                                 _t = _retTree;
2227                                 astFactory.addASTChild(currentAST, returnAST);
2228                                 currentAST = __currentAST9892;
2229                                 _t = __t9892;
2230                                 _t = _t.getNextSibling();
2231                                 res=AS_Exp_Bin_Arit( e1, e2);
2232                                 
2233                                 expresion_AST = (AST)currentAST.root;
2234                                 break;
2235                         }
2236                         case DIVISION:
2237                         {
2238                                 AST __t9893 = _t;
2239                                 AST tmp38_AST = null;
2240                                 AST tmp38_AST_in = null;
2241                                 tmp38_AST = astFactory.create((AST)_t);
2242                                 tmp38_AST_in = (AST)_t;
2243                                 astFactory.addASTChild(currentAST, tmp38_AST);
2244                                 ASTPair __currentAST9893 = currentAST.copy();
2245                                 currentAST.root = currentAST.child;
2246                                 currentAST.child = null;
2247                                 match(_t,DIVISION);
2248                                 _t = _t.getFirstChild();
2249                                 e1=expresion(_t);
2250                                 _t = _retTree;
2251                                 astFactory.addASTChild(currentAST, returnAST);
2252                                 e2=expresion(_t);
2253                                 _t = _retTree;
2254                                 astFactory.addASTChild(currentAST, returnAST);
2255                                 currentAST = __currentAST9893;
2256                                 _t = __t9893;
2257                                 _t = _t.getNextSibling();
2258                                 res=AS_Exp_Bin_Arit( e1, e2);
2259                                 
2260                                 expresion_AST = (AST)currentAST.root;
2261                                 break;
2262                         }
2263                         case LLAMADA:
2264                         {
2265                                 AST __t9894 = _t;
2266                                 AST tmp39_AST = null;
2267                                 AST tmp39_AST_in = null;
2268                                 tmp39_AST = astFactory.create((AST)_t);
2269                                 tmp39_AST_in = (AST)_t;
2270                                 astFactory.addASTChild(currentAST, tmp39_AST);
2271                                 ASTPair __currentAST9894 = currentAST.copy();
2272                                 currentAST.root = currentAST.child;
2273                                 currentAST.child = null;
2274                                 match(_t,LLAMADA);
2275                                 _t = _t.getFirstChild();
2276                                 e1=acceso(_t);
2277                                 _t = _retTree;
2278                                 astFactory.addASTChild(currentAST, returnAST);
2279                                 AST __t9895 = _t;
2280                                 AST tmp40_AST = null;
2281                                 AST tmp40_AST_in = null;
2282                                 tmp40_AST = astFactory.create((AST)_t);
2283                                 tmp40_AST_in = (AST)_t;
2284                                 astFactory.addASTChild(currentAST, tmp40_AST);
2285                                 ASTPair __currentAST9895 = currentAST.copy();
2286                                 currentAST.root = currentAST.child;
2287                                 currentAST.child = null;
2288                                 match(_t,EXPRESIONES);
2289                                 _t = _t.getFirstChild();
2290                                 l=lista_expresiones(_t);
2291                                 _t = _retTree;
2292                                 astFactory.addASTChild(currentAST, returnAST);
2293                                 currentAST = __currentAST9895;
2294                                 _t = __t9895;
2295                                 _t = _t.getNextSibling();
2296                                 currentAST = __currentAST9894;
2297                                 _t = __t9894;
2298                                 _t = _t.getNextSibling();
2299                                 res=AS_Llamada( e1, l);
2300                                 if (res != null){
2301                                         if (res.getTipo().getType() == VACIO){
2302                                                 System.out.println("ERROR: No se puede recoger el valor devuelto por un procedimiento (no devuelve nada).");
2303                                                 System.exit(1);
2304                                         }
2305                                 }
2306                                 
2307                                 expresion_AST = (AST)currentAST.root;
2308                                 break;
2309                         }
2310                         case ACCESO_TABLA:
2311                         {
2312                                 AST __t9896 = _t;
2313                                 AST tmp41_AST = null;
2314                                 AST tmp41_AST_in = null;
2315                                 tmp41_AST = astFactory.create((AST)_t);
2316                                 tmp41_AST_in = (AST)_t;
2317                                 astFactory.addASTChild(currentAST, tmp41_AST);
2318                                 ASTPair __currentAST9896 = currentAST.copy();
2319                                 currentAST.root = currentAST.child;
2320                                 currentAST.child = null;
2321                                 match(_t,ACCESO_TABLA);
2322                                 _t = _t.getFirstChild();
2323                                 e1=acceso(_t);
2324                                 _t = _retTree;
2325                                 astFactory.addASTChild(currentAST, returnAST);
2326                                 AST __t9897 = _t;
2327                                 AST tmp42_AST = null;
2328                                 AST tmp42_AST_in = null;
2329                                 tmp42_AST = astFactory.create((AST)_t);
2330                                 tmp42_AST_in = (AST)_t;
2331                                 astFactory.addASTChild(currentAST, tmp42_AST);
2332                                 ASTPair __currentAST9897 = currentAST.copy();
2333                                 currentAST.root = currentAST.child;
2334                                 currentAST.child = null;
2335                                 match(_t,EXPRESIONES);
2336                                 _t = _t.getFirstChild();
2337                                 l=lista_expresiones_nv(_t);
2338                                 _t = _retTree;
2339                                 astFactory.addASTChild(currentAST, returnAST);
2340                                 currentAST = __currentAST9897;
2341                                 _t = __t9897;
2342                                 _t = _t.getNextSibling();
2343                                 currentAST = __currentAST9896;
2344                                 _t = __t9896;
2345                                 _t = _t.getNextSibling();
2346                                 res=AS_Acceso_Tabla( e1, l);
2347                                 
2348                                 expresion_AST = (AST)currentAST.root;
2349                                 break;
2350                         }
2351                         case ACCESO_OBJETO:
2352                         case ACCESO_SIMPLE:
2353                         {
2354                                 e1=acceso(_t);
2355                                 _t = _retTree;
2356                                 astFactory.addASTChild(currentAST, returnAST);
2357                                 res=e1;
2358                                 expresion_AST = (AST)currentAST.root;
2359                                 break;
2360                         }
2361                         case LIT_ENTERO:
2362                         {
2363                                 i = (AST)_t;
2364                                 AST i_AST_in = null;
2365                                 i_AST = astFactory.create(i);
2366                                 astFactory.addASTChild(currentAST, i_AST);
2367                                 match(_t,LIT_ENTERO);
2368                                 _t = _t.getNextSibling();
2369                                 res=AS_Literal( i);
2370                                 expresion_AST = (AST)currentAST.root;
2371                                 break;
2372                         }
2373                         case LIT_REAL:
2374                         {
2375                                 j = (AST)_t;
2376                                 AST j_AST_in = null;
2377                                 j_AST = astFactory.create(j);
2378                                 astFactory.addASTChild(currentAST, j_AST);
2379                                 match(_t,LIT_REAL);
2380                                 _t = _t.getNextSibling();
2381                                 res=AS_Literal( j);
2382                                 expresion_AST = (AST)currentAST.root;
2383                                 break;
2384                         }
2385                         case LIT_CAR:
2386                         {
2387                                 k = (AST)_t;
2388                                 AST k_AST_in = null;
2389                                 k_AST = astFactory.create(k);
2390                                 astFactory.addASTChild(currentAST, k_AST);
2391                                 match(_t,LIT_CAR);
2392                                 _t = _t.getNextSibling();
2393                                 res=AS_Literal( k);
2394                                 expresion_AST = (AST)currentAST.root;
2395                                 break;
2396                         }
2397                         case CIERTO:
2398                         {
2399                                 m = (AST)_t;
2400                                 AST m_AST_in = null;
2401                                 m_AST = astFactory.create(m);
2402                                 astFactory.addASTChild(currentAST, m_AST);
2403                                 match(_t,CIERTO);
2404                                 _t = _t.getNextSibling();
2405                                 res=AS_Literal( m);
2406                                 expresion_AST = (AST)currentAST.root;
2407                                 break;
2408                         }
2409                         case FALSO:
2410                         {
2411                                 n = (AST)_t;
2412                                 AST n_AST_in = null;
2413                                 n_AST = astFactory.create(n);
2414                                 astFactory.addASTChild(currentAST, n_AST);
2415                                 match(_t,FALSO);
2416                                 _t = _t.getNextSibling();
2417                                 res=AS_Literal( n);
2418                                 expresion_AST = (AST)currentAST.root;
2419                                 break;
2420                         }
2421                         case ENTERO_A_REAL:
2422                         {
2423                                 AST __t9898 = _t;
2424                                 AST tmp43_AST = null;
2425                                 AST tmp43_AST_in = null;
2426                                 tmp43_AST = astFactory.create((AST)_t);
2427                                 tmp43_AST_in = (AST)_t;
2428                                 astFactory.addASTChild(currentAST, tmp43_AST);
2429                                 ASTPair __currentAST9898 = currentAST.copy();
2430                                 currentAST.root = currentAST.child;
2431                                 currentAST.child = null;
2432                                 match(_t,ENTERO_A_REAL);
2433                                 _t = _t.getFirstChild();
2434                                 e1=expresion(_t);
2435                                 _t = _retTree;
2436                                 astFactory.addASTChild(currentAST, returnAST);
2437                                 currentAST = __currentAST9898;
2438                                 _t = __t9898;
2439                                 _t = _t.getNextSibling();
2440                                 res = AS_Entero_A_Real(e1);
2441                                 expresion_AST = (AST)currentAST.root;
2442                                 break;
2443                         }
2444                         case REAL_A_ENTERO:
2445                         {
2446                                 AST __t9899 = _t;
2447                                 AST tmp44_AST = null;
2448                                 AST tmp44_AST_in = null;
2449                                 tmp44_AST = astFactory.create((AST)_t);
2450                                 tmp44_AST_in = (AST)_t;
2451                                 astFactory.addASTChild(currentAST, tmp44_AST);
2452                                 ASTPair __currentAST9899 = currentAST.copy();
2453                                 currentAST.root = currentAST.child;
2454                                 currentAST.child = null;
2455                                 match(_t,REAL_A_ENTERO);
2456                                 _t = _t.getFirstChild();
2457                                 e1=expresion(_t);
2458                                 _t = _retTree;
2459                                 astFactory.addASTChild(currentAST, returnAST);
2460                                 currentAST = __currentAST9899;
2461                                 _t = __t9899;
2462                                 _t = _t.getNextSibling();
2463                                 res = AS_Real_A_Entero(e1);
2464                                 expresion_AST = (AST)currentAST.root;
2465                                 break;
2466                         }
2467                         case ERROR:
2468                         {
2469                                 AST tmp45_AST = null;
2470                                 AST tmp45_AST_in = null;
2471                                 tmp45_AST = astFactory.create((AST)_t);
2472                                 tmp45_AST_in = (AST)_t;
2473                                 astFactory.addASTChild(currentAST, tmp45_AST);
2474                                 match(_t,ERROR);
2475                                 _t = _t.getNextSibling();
2476                                 expresion_AST = (AST)currentAST.root;
2477                                 break;
2478                         }
2479                         default:
2480                         {
2481                                 throw new NoViableAltException(_t);
2482                         }
2483                         }
2484                 }
2485                 catch (RecognitionException ex) {
2486                         reportError(ex);
2487                         if (_t!=null) {_t = _t.getNextSibling();}
2488                 }
2489                 returnAST = expresion_AST;
2490                 _retTree = _t;
2491                 return res;
2492         }
2493         
2494         public final void condicion(AST _t,
2495                 AST tipodev
2496         ) throws RecognitionException {
2497                 
2498                 AST condicion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2499                 returnAST = null;
2500                 ASTPair currentAST = new ASTPair();
2501                 AST condicion_AST = null;
2502                 Atr_Expr e;
2503                 
2504                 try {      // for error handling
2505                         AST __t9872 = _t;
2506                         AST tmp46_AST = null;
2507                         AST tmp46_AST_in = null;
2508                         tmp46_AST = astFactory.create((AST)_t);
2509                         tmp46_AST_in = (AST)_t;
2510                         astFactory.addASTChild(currentAST, tmp46_AST);
2511                         ASTPair __currentAST9872 = currentAST.copy();
2512                         currentAST.root = currentAST.child;
2513                         currentAST.child = null;
2514                         match(_t,SI);
2515                         _t = _t.getFirstChild();
2516                         e=expresion(_t);
2517                         _t = _retTree;
2518                         astFactory.addASTChild(currentAST, returnAST);
2519                         AST __t9873 = _t;
2520                         AST tmp47_AST = null;
2521                         AST tmp47_AST_in = null;
2522                         tmp47_AST = astFactory.create((AST)_t);
2523                         tmp47_AST_in = (AST)_t;
2524                         astFactory.addASTChild(currentAST, tmp47_AST);
2525                         ASTPair __currentAST9873 = currentAST.copy();
2526                         currentAST.root = currentAST.child;
2527                         currentAST.child = null;
2528                         match(_t,INSTRUCCIONES);
2529                         _t = _t.getFirstChild();
2530                         instrucciones(_t,tipodev);
2531                         _t = _retTree;
2532                         astFactory.addASTChild(currentAST, returnAST);
2533                         currentAST = __currentAST9873;
2534                         _t = __t9873;
2535                         _t = _t.getNextSibling();
2536                         {
2537                         if (_t==null) _t=ASTNULL;
2538                         switch ( _t.getType()) {
2539                         case INSTRUCCIONES:
2540                         {
2541                                 AST __t9875 = _t;
2542                                 AST tmp48_AST = null;
2543                                 AST tmp48_AST_in = null;
2544                                 tmp48_AST = astFactory.create((AST)_t);
2545                                 tmp48_AST_in = (AST)_t;
2546                                 astFactory.addASTChild(currentAST, tmp48_AST);
2547                                 ASTPair __currentAST9875 = currentAST.copy();
2548                                 currentAST.root = currentAST.child;
2549                                 currentAST.child = null;
2550                                 match(_t,INSTRUCCIONES);
2551                                 _t = _t.getFirstChild();
2552                                 instrucciones(_t,tipodev);
2553                                 _t = _retTree;
2554                                 astFactory.addASTChild(currentAST, returnAST);
2555                                 currentAST = __currentAST9875;
2556                                 _t = __t9875;
2557                                 _t = _t.getNextSibling();
2558                                 break;
2559                         }
2560                         case 3:
2561                         {
2562                                 break;
2563                         }
2564                         default:
2565                         {
2566                                 throw new NoViableAltException(_t);
2567                         }
2568                         }
2569                         }
2570                         currentAST = __currentAST9872;
2571                         _t = __t9872;
2572                         _t = _t.getNextSibling();
2573                         AS_Condicional(e);
2574                         
2575                         condicion_AST = (AST)currentAST.root;
2576                 }
2577                 catch (RecognitionException ex) {
2578                         reportError(ex);
2579                         if (_t!=null) {_t = _t.getNextSibling();}
2580                 }
2581                 returnAST = condicion_AST;
2582                 _retTree = _t;
2583         }
2584         
2585         public final void iteracion(AST _t,
2586                 AST tipodev
2587         ) throws RecognitionException {
2588                 
2589                 AST iteracion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2590                 returnAST = null;
2591                 ASTPair currentAST = new ASTPair();
2592                 AST iteracion_AST = null;
2593                 Atr_Expr e;
2594                 
2595                 try {      // for error handling
2596                         AST __t9877 = _t;
2597                         AST tmp49_AST = null;
2598                         AST tmp49_AST_in = null;
2599                         tmp49_AST = astFactory.create((AST)_t);
2600                         tmp49_AST_in = (AST)_t;
2601                         astFactory.addASTChild(currentAST, tmp49_AST);
2602                         ASTPair __currentAST9877 = currentAST.copy();
2603                         currentAST.root = currentAST.child;
2604                         currentAST.child = null;
2605                         match(_t,MIENTRAS);
2606                         _t = _t.getFirstChild();
2607                         e=expresion(_t);
2608                         _t = _retTree;
2609                         astFactory.addASTChild(currentAST, returnAST);
2610                         AST __t9878 = _t;
2611                         AST tmp50_AST = null;
2612                         AST tmp50_AST_in = null;
2613                         tmp50_AST = astFactory.create((AST)_t);
2614                         tmp50_AST_in = (AST)_t;
2615                         astFactory.addASTChild(currentAST, tmp50_AST);
2616                         ASTPair __currentAST9878 = currentAST.copy();
2617                         currentAST.root = currentAST.child;
2618                         currentAST.child = null;
2619                         match(_t,INSTRUCCIONES);
2620                         _t = _t.getFirstChild();
2621                         instrucciones(_t,tipodev);
2622                         _t = _retTree;
2623                         astFactory.addASTChild(currentAST, returnAST);
2624                         currentAST = __currentAST9878;
2625                         _t = __t9878;
2626                         _t = _t.getNextSibling();
2627                         currentAST = __currentAST9877;
2628                         _t = __t9877;
2629                         _t = _t.getNextSibling();
2630                         AS_Condicional(e);
2631                         
2632                         iteracion_AST = (AST)currentAST.root;
2633                 }
2634                 catch (RecognitionException ex) {
2635                         reportError(ex);
2636                         if (_t!=null) {_t = _t.getNextSibling();}
2637                 }
2638                 returnAST = iteracion_AST;
2639                 _retTree = _t;
2640         }
2641         
2642         public final Atr_Expr  acceso(AST _t) throws RecognitionException {
2643                 Atr_Expr res=null;
2644                 
2645                 AST acceso_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2646                 returnAST = null;
2647                 ASTPair currentAST = new ASTPair();
2648                 AST acceso_AST = null;
2649                 AST r_AST = null;
2650                 AST r = null;
2651                 AST a = null;
2652                 AST a_AST = null;
2653                 Atr_Expr e;
2654                 
2655                 try {      // for error handling
2656                         if (_t==null) _t=ASTNULL;
2657                         switch ( _t.getType()) {
2658                         case ACCESO_SIMPLE:
2659                         {
2660                                 e=acceso_simple(_t);
2661                                 _t = _retTree;
2662                                 astFactory.addASTChild(currentAST, returnAST);
2663                                 res=e;
2664                                 acceso_AST = (AST)currentAST.root;
2665                                 break;
2666                         }
2667                         case ACCESO_OBJETO:
2668                         {
2669                                 AST __t9901 = _t;
2670                                 AST tmp51_AST = null;
2671                                 AST tmp51_AST_in = null;
2672                                 tmp51_AST = astFactory.create((AST)_t);
2673                                 tmp51_AST_in = (AST)_t;
2674                                 astFactory.addASTChild(currentAST, tmp51_AST);
2675                                 ASTPair __currentAST9901 = currentAST.copy();
2676                                 currentAST.root = currentAST.child;
2677                                 currentAST.child = null;
2678                                 match(_t,ACCESO_OBJETO);
2679                                 _t = _t.getFirstChild();
2680                                 r = _t==ASTNULL ? null : (AST)_t;
2681                                 e=acceso_simple(_t);
2682                                 _t = _retTree;
2683                                 r_AST = (AST)returnAST;
2684                                 astFactory.addASTChild(currentAST, returnAST);
2685                                 a = (AST)_t;
2686                                 AST a_AST_in = null;
2687                                 a_AST = astFactory.create(a);
2688                                 astFactory.addASTChild(currentAST, a_AST);
2689                                 match(_t,IDENT);
2690                                 _t = _t.getNextSibling();
2691                                 currentAST = __currentAST9901;
2692                                 _t = __t9901;
2693                                 _t = _t.getNextSibling();
2694                                 
2695                                         res=AS_Acceso_Objeto( e, r, a);
2696                                 
2697                                 acceso_AST = (AST)currentAST.root;
2698                                 break;
2699                         }
2700                         default:
2701                         {
2702                                 throw new NoViableAltException(_t);
2703                         }
2704                         }
2705                 }
2706                 catch (RecognitionException ex) {
2707                         reportError(ex);
2708                         if (_t!=null) {_t = _t.getNextSibling();}
2709                 }
2710                 returnAST = acceso_AST;
2711                 _retTree = _t;
2712                 return res;
2713         }
2714         
2715         public final LinkedList  lista_expresiones(AST _t) throws RecognitionException {
2716                 LinkedList l= new LinkedList();
2717                 
2718                 AST lista_expresiones_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2719                 returnAST = null;
2720                 ASTPair currentAST = new ASTPair();
2721                 AST lista_expresiones_AST = null;
2722                 Atr_Expr e;
2723                 
2724                 try {      // for error handling
2725                         {
2726                         _loop9870:
2727                         do {
2728                                 if (_t==null) _t=ASTNULL;
2729                                 if ((_tokenSet_0.member(_t.getType()))) {
2730                                         e=expresion(_t);
2731                                         _t = _retTree;
2732                                         astFactory.addASTChild(currentAST, returnAST);
2733                                         l.add(e);
2734                                 }
2735                                 else {
2736                                         break _loop9870;
2737                                 }
2738                                 
2739                         } while (true);
2740                         }
2741                         lista_expresiones_AST = (AST)currentAST.root;
2742                 }
2743                 catch (RecognitionException ex) {
2744                         reportError(ex);
2745                         if (_t!=null) {_t = _t.getNextSibling();}
2746                 }
2747                 returnAST = lista_expresiones_AST;
2748                 _retTree = _t;
2749                 return l;
2750         }
2751         
2752         public final LinkedList  lista_expresiones_nv(AST _t) throws RecognitionException {
2753                 LinkedList l= new LinkedList();
2754                 
2755                 AST lista_expresiones_nv_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2756                 returnAST = null;
2757                 ASTPair currentAST = new ASTPair();
2758                 AST lista_expresiones_nv_AST = null;
2759                 Atr_Expr e;
2760                 
2761                 try {      // for error handling
2762                         {
2763                         int _cnt9907=0;
2764                         _loop9907:
2765                         do {
2766                                 if (_t==null) _t=ASTNULL;
2767                                 if ((_tokenSet_0.member(_t.getType()))) {
2768                                         e=expresion(_t);
2769                                         _t = _retTree;
2770                                         astFactory.addASTChild(currentAST, returnAST);
2771                                         l.add(e);
2772                                 }
2773                                 else {
2774                                         if ( _cnt9907>=1 ) { break _loop9907; } else {throw new NoViableAltException(_t);}
2775                                 }
2776                                 
2777                                 _cnt9907++;
2778                         } while (true);
2779                         }
2780                         lista_expresiones_nv_AST = (AST)currentAST.root;
2781                 }
2782                 catch (RecognitionException ex) {
2783                         reportError(ex);
2784                         if (_t!=null) {_t = _t.getNextSibling();}
2785                 }
2786                 returnAST = lista_expresiones_nv_AST;
2787                 _retTree = _t;
2788                 return l;
2789         }
2790         
2791         public final Atr_Expr  acceso_simple(AST _t) throws RecognitionException {
2792                 Atr_Expr res=null;
2793                 
2794                 AST acceso_simple_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2795                 returnAST = null;
2796                 ASTPair currentAST = new ASTPair();
2797                 AST acceso_simple_AST = null;
2798                 AST d_AST = null;
2799                 AST d = null;
2800                 
2801                 try {      // for error handling
2802                         AST __t9903 = _t;
2803                         AST tmp52_AST = null;
2804                         AST tmp52_AST_in = null;
2805                         tmp52_AST = astFactory.create((AST)_t);
2806                         tmp52_AST_in = (AST)_t;
2807                         astFactory.addASTChild(currentAST, tmp52_AST);
2808                         ASTPair __currentAST9903 = currentAST.copy();
2809                         currentAST.root = currentAST.child;
2810                         currentAST.child = null;
2811                         match(_t,ACCESO_SIMPLE);
2812                         _t = _t.getFirstChild();
2813                         AST tmp53_AST = null;
2814                         AST tmp53_AST_in = null;
2815                         tmp53_AST = astFactory.create((AST)_t);
2816                         tmp53_AST_in = (AST)_t;
2817                         astFactory.addASTChild(currentAST, tmp53_AST);
2818                         match(_t,IDENT);
2819                         _t = _t.getNextSibling();
2820                         d = _t==ASTNULL ? null : (AST)_t;
2821                         declaracion_acceso(_t);
2822                         _t = _retTree;
2823                         d_AST = (AST)returnAST;
2824                         astFactory.addASTChild(currentAST, returnAST);
2825                         currentAST = __currentAST9903;
2826                         _t = __t9903;
2827                         _t = _t.getNextSibling();
2828                         res=AS_Acceso_Simple(d_AST);
2829                         acceso_simple_AST = (AST)currentAST.root;
2830                 }
2831                 catch (RecognitionException ex) {
2832                         reportError(ex);
2833                         if (_t!=null) {_t = _t.getNextSibling();}
2834                 }
2835                 returnAST = acceso_simple_AST;
2836                 _retTree = _t;
2837                 return res;
2838         }
2839         
2840         public final void declaracion_acceso(AST _t) throws RecognitionException {
2841                 
2842                 AST declaracion_acceso_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2843                 returnAST = null;
2844                 ASTPair currentAST = new ASTPair();
2845                 AST declaracion_acceso_AST = null;
2846                 
2847                 try {      // for error handling
2848                         if (_t==null) _t=ASTNULL;
2849                         switch ( _t.getType()) {
2850                         case MODULO:
2851                         {
2852                                 declaracion_modulo(_t);
2853                                 _t = _retTree;
2854                                 astFactory.addASTChild(currentAST, returnAST);
2855                                 declaracion_acceso_AST = (AST)currentAST.root;
2856                                 break;
2857                         }
2858                         case CLASE:
2859                         {
2860                                 declaracion_clase1(_t);
2861                                 _t = _retTree;
2862                                 astFactory.addASTChild(currentAST, returnAST);
2863                                 declaracion_acceso_AST = (AST)currentAST.root;
2864                                 break;
2865                         }
2866                         case ATRIBUTO:
2867                         case METODO:
2868                         {
2869                                 declaracion_elemento_clase1(_t);
2870                                 _t = _retTree;
2871                                 astFactory.addASTChild(currentAST, returnAST);
2872                                 declaracion_acceso_AST = (AST)currentAST.root;
2873                                 break;
2874                         }
2875                         case PARAMETRO:
2876                         {
2877                                 declaracion_parametro1(_t);
2878                                 _t = _retTree;
2879                                 astFactory.addASTChild(currentAST, returnAST);
2880                                 declaracion_acceso_AST = (AST)currentAST.root;
2881                                 break;
2882                         }
2883                         case VARIABLE_LOCAL:
2884                         {
2885                                 declaracion_variable_local1(_t);
2886                                 _t = _retTree;
2887                                 astFactory.addASTChild(currentAST, returnAST);
2888                                 declaracion_acceso_AST = (AST)currentAST.root;
2889                                 break;
2890                         }
2891                         case ERROR:
2892                         {
2893                                 declaracion_error(_t);
2894                                 _t = _retTree;
2895                                 astFactory.addASTChild(currentAST, returnAST);
2896                                 declaracion_acceso_AST = (AST)currentAST.root;
2897                                 break;
2898                         }
2899                         default:
2900                         {
2901                                 throw new NoViableAltException(_t);
2902                         }
2903                         }
2904                 }
2905                 catch (RecognitionException ex) {
2906                         reportError(ex);
2907                         if (_t!=null) {_t = _t.getNextSibling();}
2908                 }
2909                 returnAST = declaracion_acceso_AST;
2910                 _retTree = _t;
2911         }
2912         
2913         public final void declaracion_clase1(AST _t) throws RecognitionException {
2914                 
2915                 AST declaracion_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2916                 returnAST = null;
2917                 ASTPair currentAST = new ASTPair();
2918                 AST declaracion_clase1_AST = null;
2919                 AST n_AST = null;
2920                 AST n = null;
2921                 
2922                 try {      // for error handling
2923                         AST __t9919 = _t;
2924                         AST tmp54_AST = null;
2925                         AST tmp54_AST_in = null;
2926                         tmp54_AST = astFactory.create((AST)_t);
2927                         tmp54_AST_in = (AST)_t;
2928                         astFactory.addASTChild(currentAST, tmp54_AST);
2929                         ASTPair __currentAST9919 = currentAST.copy();
2930                         currentAST.root = currentAST.child;
2931                         currentAST.child = null;
2932                         match(_t,CLASE);
2933                         _t = _t.getFirstChild();
2934                         n = _t==ASTNULL ? null : (AST)_t;
2935                         nombre_clase1(_t);
2936                         _t = _retTree;
2937                         n_AST = (AST)returnAST;
2938                         astFactory.addASTChild(currentAST, returnAST);
2939                         cualificador_clase1(_t);
2940                         _t = _retTree;
2941                         astFactory.addASTChild(currentAST, returnAST);
2942                         definicion_clase1(_t);
2943                         _t = _retTree;
2944                         astFactory.addASTChild(currentAST, returnAST);
2945                         currentAST = __currentAST9919;
2946                         _t = __t9919;
2947                         _t = _t.getNextSibling();
2948                         declaracion_clase1_AST = (AST)currentAST.root;
2949                 }
2950                 catch (RecognitionException ex) {
2951                         reportError(ex);
2952                         if (_t!=null) {_t = _t.getNextSibling();}
2953                 }
2954                 returnAST = declaracion_clase1_AST;
2955                 _retTree = _t;
2956         }
2957         
2958         public final void declaracion_elemento_clase1(AST _t) throws RecognitionException {
2959                 
2960                 AST declaracion_elemento_clase1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
2961                 returnAST = null;
2962                 ASTPair currentAST = new ASTPair();
2963                 AST declaracion_elemento_clase1_AST = null;
2964                 
2965                 try {      // for error handling
2966                         if (_t==null) _t=ASTNULL;
2967                         switch ( _t.getType()) {
2968                         case METODO:
2969                         {
2970                                 AST __t9927 = _t;
2971                                 AST tmp55_AST = null;
2972                                 AST tmp55_AST_in = null;
2973                                 tmp55_AST = astFactory.create((AST)_t);
2974                                 tmp55_AST_in = (AST)_t;
2975                                 astFactory.addASTChild(currentAST, tmp55_AST);
2976                                 ASTPair __currentAST9927 = currentAST.copy();
2977                                 currentAST.root = currentAST.child;
2978                                 currentAST.child = null;
2979                                 match(_t,METODO);
2980                                 _t = _t.getFirstChild();
2981                                 declaracion_metodo1(_t);
2982                                 _t = _retTree;
2983                                 astFactory.addASTChild(currentAST, returnAST);
2984                                 cualificador_elemento_clase1(_t);
2985                                 _t = _retTree;
2986                                 astFactory.addASTChild(currentAST, returnAST);
2987                                 currentAST = __currentAST9927;
2988                                 _t = __t9927;
2989                                 _t = _t.getNextSibling();
2990                                 declaracion_elemento_clase1_AST = (AST)currentAST.root;
2991                                 break;
2992                         }
2993                         case ATRIBUTO:
2994                         {
2995                                 AST __t9928 = _t;
2996                                 AST tmp56_AST = null;
2997                                 AST tmp56_AST_in = null;
2998                                 tmp56_AST = astFactory.create((AST)_t);
2999                                 tmp56_AST_in = (AST)_t;
3000                                 astFactory.addASTChild(currentAST, tmp56_AST);
3001                                 ASTPair __currentAST9928 = currentAST.copy();
3002                                 currentAST.root = currentAST.child;
3003                                 currentAST.child = null;
3004                                 match(_t,ATRIBUTO);
3005                                 _t = _t.getFirstChild();
3006                                 AST tmp57_AST = null;
3007                                 AST tmp57_AST_in = null;
3008                                 tmp57_AST = astFactory.create((AST)_t);
3009                                 tmp57_AST_in = (AST)_t;
3010                                 astFactory.addASTChild(currentAST, tmp57_AST);
3011                                 match(_t,IDENT);
3012                                 _t = _t.getNextSibling();
3013                                 tipo1(_t);
3014                                 _t = _retTree;
3015                                 astFactory.addASTChild(currentAST, returnAST);
3016                                 cualificador_elemento_clase1(_t);
3017                                 _t = _retTree;
3018                                 astFactory.addASTChild(currentAST, returnAST);
3019                                 currentAST = __currentAST9928;
3020                                 _t = __t9928;
3021                                 _t = _t.getNextSibling();
3022                                 declaracion_elemento_clase1_AST = (AST)currentAST.root;
3023                                 break;
3024                         }
3025                         default:
3026                         {
3027                                 throw new NoViableAltException(_t);
3028                         }
3029                         }
3030                 }
3031                 catch (RecognitionException ex) {
3032                         reportError(ex);
3033                         if (_t!=null) {_t = _t.getNextSibling();}
3034                 }
3035                 returnAST = declaracion_elemento_clase1_AST;
3036                 _retTree = _t;
3037         }
3038         
3039         public final void declaracion_parametro1(AST _t) throws RecognitionException {
3040                 
3041                 AST declaracion_parametro1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
3042                 returnAST = null;
3043                 ASTPair currentAST = new ASTPair();
3044                 AST declaracion_parametro1_AST = null;
3045                 
3046                 try {      // for error handling
3047                         AST __t9940 = _t;
3048                         AST tmp58_AST = null;
3049                         AST tmp58_AST_in = null;
3050                         tmp58_AST = astFactory.create((AST)_t);
3051                         tmp58_AST_in = (AST)_t;
3052                         astFactory.addASTChild(currentAST, tmp58_AST);
3053                         ASTPair __currentAST9940 = currentAST.copy();
3054                         currentAST.root = currentAST.child;
3055                         currentAST.child = null;
3056                         match(_t,PARAMETRO);
3057                         _t = _t.getFirstChild();
3058                         AST tmp59_AST = null;
3059                         AST tmp59_AST_in = null;
3060                         tmp59_AST = astFactory.create((AST)_t);
3061                         tmp59_AST_in = (AST)_t;
3062                         astFactory.addASTChild(currentAST, tmp59_AST);
3063                         match(_t,IDENT);
3064                         _t = _t.getNextSibling();
3065                         tipo1(_t);
3066                         _t = _retTree;
3067                         astFactory.addASTChild(currentAST, returnAST);
3068                         currentAST = __currentAST9940;
3069                         _t = __t9940;
3070                         _t = _t.getNextSibling();
3071                         declaracion_parametro1_AST = (AST)currentAST.root;
3072                 }
3073                 catch (RecognitionException ex) {
3074                         reportError(ex);
3075                         if (_t!=null) {_t = _t.getNextSibling();}
3076                 }
3077                 returnAST = declaracion_parametro1_AST;
3078                 _retTree = _t;
3079         }
3080         
3081         public final void declaracion_variable_local1(AST _t) throws RecognitionException {
3082                 
3083                 AST declaracion_variable_local1_AST_in = (_t == ASTNULL) ? null : (AST)_t;
3084                 returnAST = null;
3085                 ASTPair currentAST = new ASTPair();
3086                 AST declaracion_variable_local1_AST = null;
3087                 
3088                 try {      // for error handling
3089                         AST __t9949 = _t;
3090                         AST tmp60_AST = null;
3091                         AST tmp60_AST_in = null;
3092                         tmp60_AST = astFactory.create((AST)_t);
3093                         tmp60_AST_in = (AST)_t;
3094                         astFactory.addASTChild(currentAST, tmp60_AST);
3095                         ASTPair __currentAST9949 = currentAST.copy();
3096                         currentAST.root = currentAST.child;
3097                         currentAST.child = null;
3098                         match(_t,VARIABLE_LOCAL);
3099                         _t = _t.getFirstChild();
3100                         AST tmp61_AST = null;
3101                         AST tmp61_AST_in = null;
3102                         tmp61_AST = astFactory.create((AST)_t);
3103                         tmp61_AST_in = (AST)_t;
3104                         astFactory.addASTChild(currentAST, tmp61_AST);
3105                         match(_t,IDENT);
3106                         _t = _t.getNextSibling();
3107                         tipo1(_t);
3108                         _t = _retTree;
3109                         astFactory.addASTChild(currentAST, returnAST);
3110                         currentAST = __currentAST9949;
3111                         _t = __t9949;
3112                         _t = _t.getNextSibling();
3113                         declaracion_variable_local1_AST = (AST)currentAST.root;
3114                 }
3115                 catch (RecognitionException ex) {
3116                         reportError(ex);
3117                         if (_t!=null) {_t = _t.getNextSibling();}
3118                 }
3119                 returnAST = declaracion_variable_local1_AST;
3120                 _retTree = _t;
3121         }
3122         
3123         public final void tipo_predefinido_simple(AST _t) throws RecognitionException {
3124                 
3125                 AST tipo_predefinido_simple_AST_in = (_t == ASTNULL) ? null : (AST)_t;
3126                 returnAST = null;
3127                 ASTPair currentAST = new ASTPair();
3128                 AST tipo_predefinido_simple_AST = null;
3129                 
3130                 try {      // for error handling
3131                         if (_t==null) _t=ASTNULL;
3132                         switch ( _t.getType()) {
3133                         case ENTERO:
3134                         {
3135                                 AST tmp62_AST = null;
3136                                 AST tmp62_AST_in = null;
3137                                 tmp62_AST = astFactory.create((AST)_t);
3138                                 tmp62_AST_in = (AST)_t;
3139                                 astFactory.addASTChild(currentAST, tmp62_AST);
3140                                 match(_t,ENTERO);
3141                                 _t = _t.getNextSibling();
3142                                 tipo_predefinido_simple_AST = (AST)currentAST.root;
3143                                 break;
3144                         }
3145                         case REAL:
3146                         {
3147                                 AST tmp63_AST = null;
3148                                 AST tmp63_AST_in = null;
3149                                 tmp63_AST = astFactory.create((AST)_t);
3150                                 tmp63_AST_in = (AST)_t;
3151                                 astFactory.addASTChild(currentAST, tmp63_AST);
3152                                 match(_t,REAL);
3153                                 _t = _t.getNextSibling();
3154                                 tipo_predefinido_simple_AST = (AST)currentAST.root;
3155                                 break;
3156                         }
3157                         case LOGICO:
3158                         {
3159                                 AST tmp64_AST = null;
3160                                 AST tmp64_AST_in = null;
3161                                 tmp64_AST = astFactory.create((AST)_t);
3162                                 tmp64_AST_in = (AST)_t;
3163                                 astFactory.addASTChild(currentAST, tmp64_AST);
3164                                 match(_t,LOGICO);
3165                                 _t = _t.getNextSibling();
3166                                 tipo_predefinido_simple_AST = (AST)currentAST.root;
3167                                 break;
3168                         }
3169                         case CARACTER:
3170                         {
3171                                 AST tmp65_AST = null;
3172                                 AST tmp65_AST_in = null;
3173                                 tmp65_AST = astFactory.create((AST)_t);
3174                                 tmp65_AST_in = (AST)_t;
3175                                 astFactory.addASTChild(currentAST, tmp65_AST);
3176                                 match(_t,CARACTER);
3177                                 _t = _t.getNextSibling();
3178                                 tipo_predefinido_simple_AST = (AST)currentAST.root;
3179                                 break;
3180                         }
3181                         default:
3182                         {
3183                                 throw new NoViableAltException(_t);
3184                         }
3185                         }
3186                 }
3187                 catch (RecognitionException ex) {
3188                         reportError(ex);
3189                         if (_t!=null) {_t = _t.getNextSibling();}
3190                 }
3191                 returnAST = tipo_predefinido_simple_AST;
3192                 _retTree = _t;
3193         }
3194         
3195         public final void tipo_predefinido_compuesto(AST _t) throws RecognitionException {
3196                 
3197                 AST tipo_predefinido_compuesto_AST_in = (_t == ASTNULL) ? null : (AST)_t;
3198                 returnAST = null;
3199                 ASTPair currentAST = new ASTPair();
3200                 AST tipo_predefinido_compuesto_AST = null;
3201                 
3202                 try {      // for error handling
3203                         formacion(_t);
3204                         _t = _retTree;
3205                         astFactory.addASTChild(currentAST, returnAST);
3206                         tipo_predefinido_compuesto_AST = (AST)currentAST.root;
3207                 }
3208                 catch (RecognitionException ex) {
3209                         reportError(ex);
3210                         if (_t!=null) {_t = _t.getNextSibling();}
3211                 }
3212                 returnAST = tipo_predefinido_compuesto_AST;
3213                 _retTree = _t;
3214         }
3215         
3216         public final void formacion(AST _t) throws RecognitionException {
3217                 
3218                 AST formacion_AST_in = (_t == ASTNULL) ? null : (AST)_t;
3219                 returnAST = null;
3220                 ASTPair currentAST = new ASTPair();
3221                 AST formacion_AST = null;
3222                 AST t=null;
3223