Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
1 result

ts.h

Blame
  • ts.h 879 B
    #ifndef __TS__
    #define __TS__
    
    typedef struct vs_t {
        int tipo;
        int desloc;
    } vs_t;
    
    typedef struct pr_t {
        char *rot;
        int quant;
        int **param;
    } pr_t;
    
    typedef union info_t {
        vs_t vs;
        pr_t pr;
    } info_t;
    
    typedef struct simb_t {
        char *ident;
        int categ;
        int nivel;
        info_t info;
        struct simb_t *prox; // Corrigido: use explicitamente struct simb_t
    } simb_t;
    
    typedef struct ts_t {
        simb_t *topo;
        int tam;
    } ts_t;
    
    // enum de tipos
    #define NSEI 0
    #define INTEIRO 1
    #define BOOLEAN 2
    
    // enum categorias
    #define VS 0
    #define PR 1
    
    void inicializa_ts(ts_t *ts);
    
    void insere_ts(char *ident, int categ, int nivel, info_t info, ts_t *ts);
    
    simb_t *busca(char *ident, ts_t *ts); // Corrigido: retorna ponteiro para simb_t
    
    void retira(int n, ts_t *ts);
    
    void atualiza_tipo(int n, int tipo, ts_t *ts);
    
    void mostra_ts(ts_t *ts);
    
    #endif