aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-08-03 17:40:26 -0400
committerTucker Evans <tuckerevans24@gmail.com>2019-08-03 17:40:26 -0400
commit51c0c989e7beb784c772dd8328f51fb6443e751c (patch)
treebb792d3db04c6846f8c4dadfb0af719facd663fa
parent0e35d5eb2338d878283cd16357db99b49a8ee0ad (diff)
Fix id declare error during var assignment
-rw-r--r--pc.y11
1 files changed, 2 insertions, 9 deletions
diff --git a/pc.y b/pc.y
index a4a918b..6538ef6 100644
--- a/pc.y
+++ b/pc.y
@@ -9,10 +9,6 @@
#include "pc.h"
#include "sem_check.h"
-/*
-TODO:
-- Add checkid() to counter mkid()
-*/
extern int yylex();
extern scope *cur_scope;
@@ -122,11 +118,10 @@ id_list
var_declarations
:var_declarations VAR id_list ':' type ';'
{
- /*CHECK IDS HERE*/
ptree *tmp;
- for(tmp = $3; tmp; tmp = tmp->l) {
+ for(tmp = $3; tmp; tmp = tmp->l)
tmp->type = $5;
- }
+
}
|/*empty*/
;
@@ -267,13 +262,11 @@ TD: TO | DT;
var
:ID
{
- check_id(cur_scope, $1);
$$ = mkid(scope_insert(cur_scope,$1));
}
|ID '[' expr ']'
{
node* tmp;
- check_id(cur_scope, $1);
tmp = scope_insert(cur_scope, $1);
$$ = mktree(ARRAY_ACCESS, mkid(tmp), $3);