def p_statement_procedure(t):
    'procedure : PROCEDURE ID'
    print "\tDSVS "+rotulo.nome()
    rotulo.add()
    tabela.addFunc(t[2],rotulo.nome())
    print rotulo.nome() + "\tNADA"
    rotulo.remove()
    tabela.sobeNivel()
    print "\tENPR "+tabela.getNivel()
    rotulo.add()
    tabela.resetParam()
def p_statemente_function(t):
    'function : FUNCTION ID'
    print "\tDSVS "+rotulo.nome()
    rotulo.add()
    tabela.addFunc(t[2],rotulo.nome())
    print rotulo.nome()+ "\tNADA"
    rotulo.remove()
    tabela.sobeNivel()
    print "\tENPR "+tabela.getNivel()
    rotulo.add()
    tabela.resetParam()
Exemple #3
0
def p_statement_procedure(t):
    'procedure : PROCEDURE ID'
    print "\tDSVS " + rotulo.nome()
    rotulo.add()
    tabela.addFunc(t[2], rotulo.nome())
    print rotulo.nome() + "\tNADA"
    rotulo.remove()
    tabela.sobeNivel()
    print "\tENPR " + tabela.getNivel()
    rotulo.add()
    tabela.resetParam()
Exemple #4
0
def p_statemente_function(t):
    'function : FUNCTION ID'
    print "\tDSVS " + rotulo.nome()
    rotulo.add()
    tabela.addFunc(t[2], rotulo.nome())
    print rotulo.nome() + "\tNADA"
    rotulo.remove()
    tabela.sobeNivel()
    print "\tENPR " + tabela.getNivel()
    rotulo.add()
    tabela.resetParam()
def p_statement_atribuicao(t):
    'atribuicao : ID ATTRIB expression'
    if tabela.exists(t[1]):
        ident = tabela.getVar(t[1])
        if ident.eFuncao():
            ident = ident.retorno
            tabela.resetParam()
        if ident.referencia:
            print "\tARMI "+ident.getEnd()
        else:
            print "\tARMZ "+ident.getEnd()
        tipo.add(ident.getTipo())
        tipo.compara()
        tipo.reset()
    else:
        sys.stderr.write("ERRO: variavel nao definida: "+t[1]+"\n")
        raise SyntaxError
Exemple #6
0
def p_statement_atribuicao(t):
    'atribuicao : ID ATTRIB expression'
    if tabela.exists(t[1]):
        ident = tabela.getVar(t[1])
        if ident.eFuncao():
            ident = ident.retorno
            tabela.resetParam()
        if ident.referencia:
            print "\tARMI " + ident.getEnd()
        else:
            print "\tARMZ " + ident.getEnd()
        tipo.add(ident.getTipo())
        tipo.compara()
        tipo.reset()
    else:
        sys.stderr.write("ERRO: variavel nao definida: " + t[1] + "\n")
        raise SyntaxError
def p_statement_id_sub(t):
    'id_sub : ID'
    tabela.setFunc(t[1])
    tabela.resetParam()
    t[0] = t[1]
Exemple #8
0
def p_statement_id_sub(t):
    'id_sub : ID'
    tabela.setFunc(t[1])
    tabela.resetParam()
    t[0] = t[1]