Example #1
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()
Example #2
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()
Example #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()
Example #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()
Example #5
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
Example #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
Example #7
0
def p_statement_id_sub(t):
    'id_sub : ID'
    tabela.setFunc(t[1])
    tabela.resetParam()
    t[0] = t[1]
Example #8
0
def p_statement_id_sub(t):
    'id_sub : ID'
    tabela.setFunc(t[1])
    tabela.resetParam()
    t[0] = t[1]