D
daniele.zurico
Hello I've a big problem i search to parse an header file(C). I not
know how to solve the problem in the line 3 for the $4.
Someone can help me?
/* STRUCT & UNION */
struct_or_union_specifier
: struct_or_union IDENTIFIER '{' struct_declaration_list '}'
{ printf("%d,%s,%s",$1->type,$2->word_name,$4???????????) }
| struct_or_union '{' struct_declaration_list '}'
| struct_or_union IDENTIFIER
;
struct_or_union
: STRUCT { $$=mktype(TSTRUCT); }
| UNION { $$=mktype(TUNION); }
;
struct_declaration_list
: struct_declaration
| struct_declaration_list struct_declaration
;
struct_declaration
: specifier_qualifier_list struct_declarator_list ';'
;
specifier_qualifier_list
: type_specifier specifier_qualifier_list
| type_specifier
;
struct_declarator_list
: struct_declarator
| struct_declarator_list ',' struct_declarator
;
struct_declarator
: declarator
| ':' LNG
| declarator ':' LNG
;
declarator
: pointer direct_declarator
| direct_declarator
;
pointer
: '*'
| '*' pointer
;
direct_declarator
: IDENTIFIER
| '(' declarator ')'
| direct_declarator '[' LNG ']'
| direct_declarator '[' ']'
| direct_declarator '(' parameter_list ')'
| direct_declarator '(' identifier_list ')'
| direct_declarator '(' ')'
;
parameter_list
: parameter_declaration
| parameter_list ',' parameter_declaration
;
identifier_list
: IDENTIFIER
| identifier_list ',' IDENTIFIER
;
parameter_declaration
: declaration_specifiers declarator
| declaration_specifiers abstract_declarator
| declaration_specifiers
;
direct_abstract_declarator
: '(' abstract_declarator ')'
| '[' ']'
| '[' LNG ']'
| direct_abstract_declarator '[' ']'
| direct_abstract_declarator '[' LNG ']'
| '(' ')'
| '(' parameter_list ')'
| direct_abstract_declarator '(' ')'
| direct_abstract_declarator '(' parameter_list ')'
;
abstract_declarator
: pointer
| direct_abstract_declarator
| pointer direct_abstract_declarator
;
know how to solve the problem in the line 3 for the $4.
Someone can help me?
/* STRUCT & UNION */
struct_or_union_specifier
: struct_or_union IDENTIFIER '{' struct_declaration_list '}'
{ printf("%d,%s,%s",$1->type,$2->word_name,$4???????????) }
| struct_or_union '{' struct_declaration_list '}'
| struct_or_union IDENTIFIER
;
struct_or_union
: STRUCT { $$=mktype(TSTRUCT); }
| UNION { $$=mktype(TUNION); }
;
struct_declaration_list
: struct_declaration
| struct_declaration_list struct_declaration
;
struct_declaration
: specifier_qualifier_list struct_declarator_list ';'
;
specifier_qualifier_list
: type_specifier specifier_qualifier_list
| type_specifier
;
struct_declarator_list
: struct_declarator
| struct_declarator_list ',' struct_declarator
;
struct_declarator
: declarator
| ':' LNG
| declarator ':' LNG
;
declarator
: pointer direct_declarator
| direct_declarator
;
pointer
: '*'
| '*' pointer
;
direct_declarator
: IDENTIFIER
| '(' declarator ')'
| direct_declarator '[' LNG ']'
| direct_declarator '[' ']'
| direct_declarator '(' parameter_list ')'
| direct_declarator '(' identifier_list ')'
| direct_declarator '(' ')'
;
parameter_list
: parameter_declaration
| parameter_list ',' parameter_declaration
;
identifier_list
: IDENTIFIER
| identifier_list ',' IDENTIFIER
;
parameter_declaration
: declaration_specifiers declarator
| declaration_specifiers abstract_declarator
| declaration_specifiers
;
direct_abstract_declarator
: '(' abstract_declarator ')'
| '[' ']'
| '[' LNG ']'
| direct_abstract_declarator '[' ']'
| direct_abstract_declarator '[' LNG ']'
| '(' ')'
| '(' parameter_list ')'
| direct_abstract_declarator '(' ')'
| direct_abstract_declarator '(' parameter_list ')'
;
abstract_declarator
: pointer
| direct_abstract_declarator
| pointer direct_abstract_declarator
;