All pastes #233297 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-11-01 21:34 UTC
rendered paste body
public void addFuncion(String retorno, String nombre, String parametro){
        Tipo retur = new Tipo(retorno);
        Elemento e = new Elemento(retur,"toFloat");
        Tipo param = new Tipo(parametro);
        Elemento parm = new Elemento(param,"s");
        ArgList a = new ArgList();
        a.add(parm);
        Funcion f = new Funcion(e,a);
        Declaracion d = new Declaracion("FUNC",f); 
        this.declaraciones.add(d);
    }
    
    public void addFunciones(){
      
    /************* Agrega la funcion toFloat *******************************/
        addFuncion("float","toFloat","string");
    /************* Agrega la funcion toInt *******************************/
        addFuncion("int","toInt","string");
    /************* Agrega la funcion trunc *******************************/
        addFuncion("int","trunc","float");
    /************* Agrega la funcion toString *******************************/       
        addFuncion("string","toString","int");
    /************* Agrega la funcion toString *******************************/     
        addFuncion("string","toString","bool");
    /************* Agrega la funcion toString *******************************/       
        addFuncion("string","toString","float");
    /************* Agrega la funcion print *******************************/       
        addFuncion("void","toString","float");
        Elemento e6 = new Elemento("Void","print");
        Elemento parm6 = new Elemento("Expr","s6");
        ArgList a6 = new ArgList();
        a6.add(parm6);
        Funcion f6 = new Funcion(e6,a6);
        Declaracion d6 = new Declaracion("FBAS",f6); 
        this.declaraciones.add(d6);
    /************* Agrega la funcion read *******************************/       
        Elemento e7 = new Elemento("Void","read");
        Elemento parm7 = new Elemento("Var","s7");
        ArgList a7 = new ArgList();
        a7.add(parm7);
        Funcion f7 = new Funcion(e7,a7);
        Declaracion d7 = new Declaracion("FBAS",f7); 
        this.declaraciones.add(d7);   
    }