fixed some grammar rules
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
extern TableNode* chara;
|
||||
extern TableNode* stri;
|
||||
extern TableNode* boo;
|
||||
TableNode * tn;
|
||||
%}
|
||||
//%define api.location.type {location_t}
|
||||
%locations
|
||||
@ -118,7 +119,6 @@ prototype_or_definition_list:
|
||||
prototype:
|
||||
L_PAREN EXTERNAL R_PAREN FUNCTION ID COLON ID;
|
||||
|
||||
definition:
|
||||
definition:
|
||||
TYPE ID COLON {tn = CreateEntry(getAncestor(cur), recprime, $2, CreateRecordInfo(0, cur = CreateScope(cur, 0, 0)));
|
||||
if (table_lookup(getAncestor(cur), $2) == NULL) {
|
||||
@ -173,10 +173,6 @@ FUNCTION ID COLON ID {CreateEntry(cur, look_up(cur, $4), $2, CreateFunctionDecla
|
||||
| EXTERNAL FUNCTION ID COLON ID {CreateEntry(cur, look_up(cur, $5), $3, NULL);}
|
||||
;
|
||||
|
||||
parameter:
|
||||
L_PAREN ID R_PAREN
|
||||
| AS L_PAREN idlist R_PAREN
|
||||
;
|
||||
|
||||
idlist:
|
||||
ID {
|
||||
@ -222,7 +218,7 @@ declaration:
|
||||
;
|
||||
|
||||
id_or_types:
|
||||
ID {printf("string of id in id_or_type is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
ID {printf("string of id in id_or_type is %s\n",$<words>1); $$ = getType(look_up(cur,$1));}
|
||||
| types {printf("string of type in id_or_type is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
;
|
||||
|
||||
@ -276,7 +272,8 @@ ID {TableNode *node = table_lookup(cur, $<words>1);
|
||||
}
|
||||
$$ = getName(getReturn(look_up(cur, $1)));
|
||||
}
|
||||
| assignable rec_op ID {TableNode * tn; printf("this is assignable.id %s\n", getType(look_up(cur, $1)));if(NULL != (tn = table_lookup(getRecList(look_up(cur, $1)), $3)))
|
||||
| assignable rec_op ID {TableNode * tn; printf("this is assignable.id %s\n", getType(look_up(cur, $1)));
|
||||
if(NULL != (tn = table_lookup(getRecList(look_up(cur, $1)), $3)))
|
||||
{$$ = "test";}
|
||||
}
|
||||
;
|
||||
|
Reference in New Issue
Block a user