Got symbol Table largely working (but without certain entries being added like functions or records)
This commit is contained in:
@ -19,6 +19,8 @@
|
||||
extern FILE * yyin;
|
||||
extern TableNode* funprime;
|
||||
extern TableNode* arrayprim;
|
||||
extern TableNode* recprime;
|
||||
extern TableNode* funtypeprime;
|
||||
extern TableNode* integ;
|
||||
extern TableNode* addr;
|
||||
extern TableNode* chara;
|
||||
@ -33,6 +35,9 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
%type <words> expression
|
||||
%type <words> constant
|
||||
%type <words> id_or_types
|
||||
%type <words> types
|
||||
%token <words> ID 101
|
||||
@ -150,7 +155,7 @@ declaration_list:
|
||||
;
|
||||
|
||||
declaration:
|
||||
id_or_types COLON ID {CreateEntry(cur,$<words>1,$<words>3); }
|
||||
id_or_types COLON ID {CreateEntry(cur,$<words>1,$<words>3,NULL); }
|
||||
;
|
||||
|
||||
id_or_types:
|
||||
@ -188,8 +193,7 @@ rec_op :
|
||||
expression:
|
||||
|
||||
constant {printf("constant expression\n");} {$$ = $<words>1;}
|
||||
| SUB_OR_NEG expression {if(strcmp($2,integer) != 0) {printf("cant negate something not an integer at
|
||||
line %d and column %d\n",@2.first_line,@2.first_column);}} %prec UMINUS {printf("negative expression\n");}
|
||||
| SUB_OR_NEG expression {if(strcmp($2,"integer") != 0) {printf("cant negate something not an integer at line %d and column %d\n",@2.first_line,@2.first_column);}} %prec UMINUS {printf("negative expression\n");}
|
||||
|
||||
| NOT expression {printf("not expression\n");}
|
||||
| expression ADD expression {printf("add expression\n");}
|
||||
|
Reference in New Issue
Block a user