Skip to content

Commit

Permalink
Semantica acabada
Browse files Browse the repository at this point in the history
Tota la semantica acabada (semantic.cc) i tots els jocs de proves passats desde el jp0 fins al jp13.
  • Loading branch information
arol committed Apr 25, 2011
1 parent edfa82b commit 413116a
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 178 deletions.
Binary file modified .DS_Store
Binary file not shown.
29 changes: 15 additions & 14 deletions Practica Alex/semantic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,25 +343,26 @@ void TypeCheck(AST *a,string info)

if(info == "instruction"){
if (symboltable[a->down->text].tp->kind != "procedure"){
errorisnotprocedure(a->line);
}
if(symboltable[a->down->text].tp->kind == "procedure" || symboltable[a->down->text].tp->kind == "function"){
errorisnotprocedure(a->line);
}

if(symboltable[a->down->text].tp->kind == "procedure" || symboltable[a->down->text].tp->kind == "function"){
check_params(a->down->right->down, symboltable[a->down->text].tp->down, a->line, 0);
a->ref = 0;
}
}
else{
if(a->tp->kind != "function"){
errorisnotfunction(a->line);
}
check_params(a->down->right->down, symboltable[a->down->text].tp->down, a->line, 0);
a->ref=0;
if(a->tp->kind == "function"){
a->tp = symboltable[a->down->text].tp->right;
}
else{
a->tp = create_type("error", 0, 0);
}
if(a->tp->kind != "function"){
errorisnotfunction(a->line);
}
check_params(a->down->right->down, symboltable[a->down->text].tp->down, a->line, 0);
a->ref=0;
if(a->tp->kind == "function"){
a->tp = symboltable[a->down->text].tp->right;
}
else{
a->tp = create_type("error", 0, 0);
}
}
}
}
Expand Down
Binary file modified practica/cl
Binary file not shown.
Loading

0 comments on commit 413116a

Please sign in to comment.