aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-07-31 21:59:48 -0400
committerTucker Evans <tuckerevans24@gmail.com>2019-07-31 21:59:48 -0400
commitf1c02ce1c731d3b7cbe505764352012b7ab83887 (patch)
tree71d7d400e6f4d16ce4d25cbde4510d7ef184e26d
parenta7d28593769b094d52407c92b8e5554a3e9cd178 (diff)
WIP Start dealing with semantic checking of ids
Current bugs: Checks id during var assignment
-rw-r--r--pc.y12
1 files changed, 9 insertions, 3 deletions
diff --git a/pc.y b/pc.y
index f00d4fe..a4a918b 100644
--- a/pc.y
+++ b/pc.y
@@ -102,21 +102,27 @@ program
id_list
:ID
{
+ /*TODO remove check_ids*/
+ node *tmp;
check_id(cur_scope, $1);
- $$ = scope_insert(cur_scope, $1);
+ tmp = scope_insert(cur_scope, $1);
+ $$ = mkid(tmp);
}
|id_list ',' ID
{
- check_id(cur_scope, $3);
+ node *tmp;
- $$ = mktree(LIST, $1, scope_insert(cur_scope, $3));
+ check_id(cur_scope, $3);
+ tmp = scope_insert(cur_scope, $3);
+ $$ = mktree(LIST, $1, mkid(tmp));
}
;
var_declarations
:var_declarations VAR id_list ':' type ';'
{
+ /*CHECK IDS HERE*/
ptree *tmp;
for(tmp = $3; tmp; tmp = tmp->l) {
tmp->type = $5;