still working on resolving type name issue
This commit is contained in:
@ -28,8 +28,6 @@
|
||||
|
||||
%type <words> id_or_types
|
||||
%type <words> types
|
||||
%type expression
|
||||
%type constant
|
||||
%token <words> ID 101
|
||||
%token <words> T_INTEGER 201
|
||||
%token <words> T_ADDRESS 202
|
||||
@ -37,11 +35,11 @@
|
||||
%token <words> T_CHARACTER 204
|
||||
%token <words> T_STRING 205
|
||||
%token <integ> C_INTEGER 301
|
||||
%token C_NULL 302
|
||||
%token C_CHARACTER 303
|
||||
%token C_STRING 304
|
||||
%token C_TRUE 305
|
||||
%token C_FALSE 306
|
||||
%token <words> C_NULL 302
|
||||
%token <words> C_CHARACTER 303
|
||||
%token <words> C_STRING 304
|
||||
%token <words> C_TRUE 305
|
||||
%token <words> C_FALSE 306
|
||||
%token WHILE 401
|
||||
%token IF 402
|
||||
%token THEN 403
|
||||
@ -111,15 +109,15 @@ prototype:
|
||||
definition:
|
||||
TYPE ID COLON dblock
|
||||
| TYPE ID COLON constant ARROW ID
|
||||
| function_declaration
|
||||
//| function_declaration
|
||||
| TYPE ID COLON id_or_types ARROW id_or_types
|
||||
| ID parameter ASSIGN sblock
|
||||
;
|
||||
|
||||
function_declaration:
|
||||
FUNCTION ID COLON ID
|
||||
| EXTERNAL FUNCTION ID COLON ID
|
||||
;
|
||||
//function_declaration:
|
||||
// FUNCTION ID COLON ID
|
||||
//| EXTERNAL FUNCTION ID COLON ID
|
||||
//;
|
||||
|
||||
parameter:
|
||||
L_PAREN ID R_PAREN
|
||||
@ -145,12 +143,12 @@ declaration_list:
|
||||
;
|
||||
|
||||
declaration:
|
||||
id_or_types COLON ID {CreateEntry(cur,$1,$3); }
|
||||
id_or_types COLON ID {CreateEntry(cur,$<words>1,$<words>3); }
|
||||
;
|
||||
|
||||
id_or_types:
|
||||
ID
|
||||
| types
|
||||
ID {printf("string of id in id_or_type is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
| types {printf("string of type in id_or_type is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
;
|
||||
|
||||
statement_list:
|
||||
@ -226,11 +224,11 @@ constant:
|
||||
;
|
||||
|
||||
types:
|
||||
T_STRING
|
||||
| T_INTEGER
|
||||
| T_ADDRESS
|
||||
| T_CHARACTER
|
||||
| T_BOOLEAN
|
||||
T_STRING {printf("string of T_STRING in types is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
| T_INTEGER {printf("string of T_INTEGER in types is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
| T_ADDRESS {printf("string of T_ADDRESS in types is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
| T_CHARACTER {printf("string of T_CHARACTER in types is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
| T_BOOLEAN {printf("string of T_BOOLEAN in types is %s\n",$<words>1);} {$$ = $<words>1;}
|
||||
;
|
||||
|
||||
%%
|
||||
|
Reference in New Issue
Block a user