public object VisitProgramDAST(ProgramDAST v,object arg)
 {
     if (identificadores.retrieve(v.ident.ident.value)==null)
     {
         identificadores.open_scope();
         tipos.open_scope();
         arreglos.open_scope();
         identificadores.enter(v.ident.ident.value,"",null);
         if(v.declaraciones != null)
         {
             v.declaraciones.visit(this,"programa");
         }
     }
     else{
         errores_contextuales+="Error Contextual: El identificador \""+v.ident.ident+"\" ya ha sido utilizado.\n";
     }
     return null;
 }
        public object VisitProgramDAST(ProgramDAST v,object arg)
        {
            Type pointType = null;

            AppDomain currentDom = Thread.GetDomain();

            string asmFileName = "compilador.exe";

            AssemblyName myAsmName = new AssemblyName();
            myAsmName.Name = "Ensamblaje";

            AssemblyBuilder myAsmBldr = currentDom.DefineDynamicAssembly(
                myAsmName,
                AssemblyBuilderAccess.RunAndSave);

            modulo = myAsmBldr.DefineDynamicModule(asmFileName,
                                                   asmFileName);

            TypeBuilder act = modulo.DefineType(v.ident.ident.value);
            Type objType = Type.GetType("System.Object");
            ConstructorInfo objCtor = objType.GetConstructor(new Type[0]);

            ConstructorBuilder pointCtor = act.DefineConstructor(
                                       MethodAttributes.Public,
                                      CallingConventions.Standard,
                                      null);

            ILGenerator ctorIL = pointCtor.GetILGenerator();
            ctorIL.Emit(OpCodes.Ldarg_0);
            ctorIL.Emit(OpCodes.Call, objCtor);
            ctorIL.Emit(OpCodes.Ret);

            v.declaraciones.visit(this,act);

            pointType = act.CreateType();

            Console.WriteLine("Tipo Completado");

            myAsmBldr.Save(asmFileName);

            Console.WriteLine("Emsamblaje guardado con el nombre '{0}'.", asmFileName);

            return pointType;
        }
        public object VisitProgramDAST(ProgramDAST v,object arg)
        {
            int numaux = ((int)arg);
            printtab(numaux);
            resultado = resultado +"\n"+(v.GetType());

            if (v.declaraciones != null)
                v.declaraciones.visit(this,numaux+1);
            else
            {
                printtab(numaux+1);
                resultado = resultado +"\n"+("NULL");
            }
            return null;
        }