Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void check_AST_Anotada(n1 root, int depth,n1 pai, int flag){
- if(flagt == 2){ /*|| flagt == 1*/
- int i;
- char* desc_pai;
- if(root != NULL){
- if(strcmp(root->descricao,"Add") == 0 || strcmp(root->descricao,"Mul") == 0 || strcmp(root->descricao,"Sub") == 0 || strcmp(root->descricao,"Div") == 0){
- root->type = expression_Type(root);
- /*printf("%s - %s\n",root->descricao,root->type);*/
- }
- else if(strcmp(root->descricao,"Assign") == 0){
- /*Verificar se o id existe, se os filhos teem o mesmo tipo e ver se esta declarada com o mesmo tipo*/
- root->type = assign_type(root);
- /*printf("%s - %s\n",root->descricao,assign_type(root));*/
- }
- else if(strcmp(root->descricao,"Call") == 0){ /*Ver se os parametros estao todos coorrespondentes*/
- if(strcmp(Check_Type(root->filhos->valor,"return"),"none") == 0){
- root->type = "none";
- }
- else{
- root->type = Check_Type(root->filhos->valor,"return");
- }
- }
- else if(strcmp(root->descricao,"Minus") == 0 || strcmp(root->descricao,"Plus")==0){
- /*Ver se é int ou float32*/
- root->type = expr_Unary_Type(root);
- }
- else if(strcmp(root->descricao,"Comma") == 0){
- root->type = expression_Comma_Type(root);
- }
- else if(strcmp(root->descricao,"ParseArgs") == 0){
- root->type = root->filhos->type;
- }
- check_AST_Anotada(root->filhos, depth + 1, root, 0);
- check_AST_Anotada(root->irmaos, depth, pai , 1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement