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