F diff --git a/denoted.c b/denoted.c --- a/denoted.c +++ b/denoted.creturn (struct Denoted*)ret;}- struct Denoted* get_denoted_function(struct Denotation_Prototype *prototype)+ struct Denoted* get_denoted_base(struct token *id,struct Type *type,enum Denotation_Type denotation)+ {+ struct Denoted_Base *ret;+ ret=malloc(sizeof(struct Denoted_Base));+ ret->denotation=denotation;+ ret->id=id;+ ret->type=type;+++ return (struct Denoted*)ret;+ }+ struct Denoted* get_denoted_function(struct token *id,struct Type *return_type,enum Function_Specifier fs){struct Denoted_Function *ret;ret=malloc(sizeof(struct Denoted_Function));ret->denotation=DT_Function;- ret->type=prototype->type;- ret->function_specifier=prototype->function_specifier;+ ret->id=id;+ ret->return_type=return_type;+ ret->function_specifier=fs;ret->body=NULL;return (struct Denoted*)ret;}- struct Denoted* get_denoted_object(struct token *id, struct Object *object)+ struct Denoted* get_denoted_object(struct token *id, enum Storage_Class sc,struct Location *where,struct Type *type){struct Denoted_Object *ret;ret=malloc(sizeof(struct Denoted_Object));ret->denotation=DT_Object;ret->id=id;- ret->object=object;++ ret->object=malloc(sizeof(struct Object));+ ret->object->type=type;+ ret->object->location=get_location_for_denoted_object(where,type,id);+ ret->object->storage_class=sc;return (struct Denoted*)ret;}- struct Denoted* get_denoted_typedef(struct Denotation_Prototype *prototype)+ struct Denoted* get_denoted_typedef(struct Denoted_Base *base){struct Denoted_Typedef *ret;ret=malloc(sizeof(struct Denoted_Typedef));ret->denotation=DT_Typedef;- ret->type=prototype->type;- ret->id=prototype->id;+ ret->type=base->type;+ ret->id=base->id;return (struct Denoted*)ret;F diff --git a/denoted.h b/denoted.h --- a/denoted.h +++ b/denoted.henum Denotation_Type denotation;struct Denoted *error;};- struct Denoted_Function+ struct Denoted_Base{enum Denotation_Type denotation;- enum Function_Specifier function_specifier;-struct Type *type;struct token *id;+ };+ struct Denoted_Function+ {+ enum Denotation_Type denotation;+ struct Type *return_type;+ struct token *id;+++ enum Function_Specifier function_specifier;struct AST_Compound_Statement *body;};struct Denoted_Object{enum Denotation_Type denotation;struct token *id;+struct Object *object;};struct Denoted_Typedef{enum Denotation_Type denotation;- struct token *id;struct Type *type;+ struct token *id;+};struct Denoted_Enum{enum Denotation_Type denotation;struct token *id;+struct Enum *enumeration;};struct Denoted_Enum_Const{enum Denotation_Type denotation;struct token *id;+struct Type_Enum *parent;int value;};{enum Denotation_Type denotation;struct token *id;+struct Struct_Union *struct_union;};struct Denotation_Prototype{enum Denotation_Type denotation;+ struct Type *type;++enum Storage_Class storage_class;enum Type_Specifier specifier;enum Type_Constraint constraint;enum Type_Signedness sign;enum Function_Specifier function_specifier;- struct Type *type;-- struct token *id;-struct Struct_Union *struct_union;struct Enum *enumerator;};struct Denoted* get_denoted_error(struct Denoted *error);- struct Denoted* get_denoted_function(struct Denotation_Prototype *prototype);- struct Denoted* get_denoted_object(struct token *id, struct Object *object);- struct Denoted* get_denoted_typedef(struct token* id,struct Type *typedefed);+ struct Denoted* get_denoted_function(struct token *id,struct Type *return_type,enum Function_Specifier fs);+ struct Denoted* get_denoted_object(struct token *id, enum Storage_Class sc,struct Location *where,struct Type *type);+ struct Denoted* get_denoted_typedef(struct Denoted_Base *base);struct Denoted* get_denoted_enum_const(struct token *id,struct Type_Enum *parent,int value);struct Denoted* get_denoted_enum(struct token *id,struct Enum *enumerator);struct Denoted* get_denoted_struct_union(struct token *id,struct Struct_Union *struct_union);F diff --git a/location.c b/location.c --- a/location.c +++ b/location.creturn ret;}+ /*base is modified*/+ struct Location *get_location_for_denoted_object(struct Location *base,struct Type *type,struct token *id)+ {+ if(base->type==LT_ON_STACK)+ {+ struct Location_Stack *hold;+ hold=malloc(sizeof(struct Location_Stack));+ *hold=*(struct Location_Stack*)base;+ base->offset+=type->size;++ return (struct Location*)hold;+ }else if(base->type==LT_RELATIVE)+ {+ struct Location_Relative *hold;++ hold=malloc(sizeof(struct Location_Relative));+ *hold=*(struct Location_Relative*)base;++ return (struct Location*)hold;+ }else if(base->type==LT_GLOBAL)+ {+ struct Location_Labeled *hold;+ hold=malloc(sizeof(struct Location_Labeled));+ hold->id=id;++ return hold;+ }+ }#endifF diff --git a/location.h b/location.h --- a/location.h +++ b/location.h{LT_ON_STACK,LT_RAW,- LT_RELATIVE+ LT_RELATIVE,+ LT_LABELED,+ LT_GLOBAL};struct Location{size_t offset;};+ struct Location_Labeled+ {+ enum Location_Type type;+ struct token *id;+ };#endifF diff --git a/parse_declaration.c b/parse_declaration.c --- a/parse_declaration.c +++ b/parse_declaration.c/*declaration-specifiers init-declarator (,init-declarator)* ;*//* init-declarator: declarator [ = initializer ] */- void parse_declaration(struct Queue *tokens,struct Scope *scope,struct Queue *where_to_push,char parse_function_definitions)+ void parse_declaration(struct Queue *tokens,struct Scope *scope,struct Queue *where_to_push,char parse_function_definitions,struct Location *where){- struct Type *hold_type;struct Denotation_Prototype *prototype;struct Denoted *hold;- prototype=(struct Denotation_Prototype*)parse_declaration_specifiers(tokens,scope);- if(((struct Denoted*)prototype)->denotation==DT_Error)+ prototype=parse_declaration_specifiers(tokens,scope);+ while(!get_and_check(tokens,KW_SEMI_COLUMN)){- /*TODO error*/- Queue_Push(where_to_push,get_error_tree(get_declaration_error_tree(prototype)));- return ;- }-- if(prototype->specifiers==TS_ENUM)- {- prototype->type=get_enum_type(prototype);- }else if(prototype->specifiers==TS_STRUCT || prototype->specifiers==TS_UNION)- {- prototype->type=get_struct_union_type(prototype);- }else- {- prototype->type=get_basic_type(prototype);- }--- do{- hold=parse_declarator(tokens,scope,prototype);- if(hold->denotation!=DT_Error)+ hold=parse_declarator(tokens,scope,prototype,where);+ if(hold->denotation==DT_Function && parse_function_definitions==1){- if(hold->denotation==DT_Typedef)- {- Queue_Push(where_to_push,(struct AST*)get_type_definition_tree((struct Denoted_Typedef*)hold,scope));- }else if(hold->denotation==DT_Object)- {- Queue_Push(where_to_push,(struct AST*),get_object_declaration_tree((struct Denoted_Object*)hold,parse_initializer(tokens,scope,(struct Denoted_Object*)hold),scope));- }else if(hold->denotation==DT_Function)- {- if(parse_function_definitions==1 && get_and_check(tokens,KW_OPEN_CURLY))- {- ((struct Denoted_Function*)hold)->body=parse_finish_compound_statement(tokens,scope);-- Queue_Push(where_to_push,(struct AST*)get_function_definition_tree(scope,(struct Denoted_Function*)hold));- return ;- }- Queue_Push(where_to_push,(struct AST*)get_function_declaration(scope,(struct Denoted_Function*)hold));- }else+ if(get_and_check(tokens,KW_OPEN_CURLY)){- /*todo error*/- /*shouldnt be able to reach here*/- Queue_Push(where_to_push,(struct AST*)get_error_tree((struct AST*)get_declaration_error_tree(hold)));- return ;+ ((struct Denoted_Function*)hold)->body=parse_finish_compound_statement(tokens,scope);+ Queue_Push(where_to_push,get_function_declaration_tree(scope,(struct Denoted_Function*)hold));+ return;}-- Scope_Push(scope,hold);+ Queue_Push(where_to_push,get_function_declaration_tree(scope,(struct Denoted_Function*)hold));+ }else if(hold->denotation==DT_Typedef)+ {+ Queue_Push(where_to_push,get_type_definition_tree((struct Denoted_Typedef*)hold,scope);+ }else if(hold->denotation==DT_Object)+ {+ Queue_Push(where_to_push,get_object_declaration_tree((struct Denoted_Object*)hold,NULL,scope));}else{- /*todo error*/- Queue_Push(where_to_push,get_error_tree(get_denoted_error(hold)));- return ;+ /*TODO error*/+ Queue_Push(where_to_push,get_declaration_error_tree(hold));+ return;}-parse_function_definitions=0;-- }while(get_and_check(tokens,KW_COMMA));- if(!get_and_check(tokens,KW_SEMI_COLUMN))- {- /*TODO error*/- Queue_Push(where_to_push,get_error_tree(NULL));}}+ /*hack*/+ struct Denotation_Prototype* parse_specifier_qualifier_list(struct Queue *tokens,struct Scope *scope)+ {+ enum KEYWORDS hold_kw;+ struct Denotation_Prototype *ret;+ ret=get_denotation_prototype();+ while(1)+ {+ hold_kw=kw_get(tokens);+ switch(hold_kw)+ {+ case KW_CONST:+ chomp(tokens);+ ret->is_const=1;+ break;+ case KW_VOLATILE:+ chomp(tokens);+ ret->is_volatile=1;+ break;+ case KW_INT:+ chomp(tokens);+ if(ret->specifier!=TS_NONE)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ ret->specifier=TS_INT;+ break;+ case KW_VOID:+ chomp(tokens);+ if(ret->specifier!=TS_NONE)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ ret->specifier=TS_VOID;+ break;+ case KW_CHAR:+ chomp(tokens);+ if(ret->specifier!=TS_NONE)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ ret->specifier=TS_CHAR;+ break;+ case KW_DOUBLE:+ chomp(tokens);+ if(ret->specifier!=TS_NONE)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ ret->specifier=TS_DOUBLE;+ break;+ case KW_FLOAT:+ chomp(tokens);+ if(ret->specifier!=TS_NONE)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ ret->specifier=TS_FLOAT;+ break;+ case KW_LONG:+ chomp(tokens);+ if(ret->constraint!=TC_NONE)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ ret->constraint=TC_LONG;+ break;+ case KW_SHORT:+ chomp(tokens);+ if(ret->constraint!=TC_NONE)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ ret->constraint=TC_SHORT;+ break;+ case KW_STRUCT:+ ret->specifier=TS_STRUCT;+ goto hack;+ case KW_UNION:+ ret->specifier=TS_UNION;+ hack:+ chomp(tokens);+ if(check(tokens,KW_ID))+ {+ struct token *id;+ struct Denoted_Struct_Union *tag;+ id=Queue_Pop(tokens);+ tag=check_tag(scope,id);++ if(tag==NULL)+ {+ struct Struct_Union *body;+ body=parse_struct_union_specifier_finish(tokens,scope);+ tag=get_denoted_struct_union(id,body);+ Scope_Push(scope,(struct Denoted*)tag);+ ret->struct_union=body;+ }else+ {+ ret->struct_union=tag->struct_union;+ if(ret->struct_union->specifier!=ret->specifier)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ }++ }else+ {+ ret->struct_union=parse_struct_union_specifier_finish(tokens,scope);+ }+ break;+ case KW_ENUM:+ chomp(tokens);+ ret->specifier=TS_ENUM;+ if(check(tokens,KW_ID))+ {+ struct token *id;+ struct Denoted_Enum *enumerator;+ id=Queue_Pop(tokens);+ enumerator=check_tag(scope,id);+ if(enumerator==NULL)+ {+ struct Enum body;+ body=parse_enum_specifier_finish(tokens,scope);+ enumerator=get_denoted_enum(id,body);+ Scope_Push(scope,(struct Denoted*)enumerator);+ ret->enumerator=body;+ }else+ {+ ret->enumerator=enumerator->enumeration;+ if(enumeration->enumeration->specifier!=TS_ENUM)+ {+ return get_denotation_error((struct Denoted*)ret);+ }+ }++ }else+ {+ ret->enumeration=parse_enum_specifier_finish(tokens,scope);+ }+ break;+ case KW_ID:+ if(ret->specifier==TS_NONE)+ {+ struct Denoted *hold;+ hold=check_ordinary(scope,(struct token*)tokens->first.data);+ if(hold!=NULL && hold->denotation==DT_Typedef)+ {+ chomp();+ ret->type=((struct Denoted_Typedef*)hold)->type;+ break;+ }+ /*falltrough - this has not been typedefed*/+ }+ /*falltrough (it is possible to overwrite typedef id from upper scope)*/+ default:+ if(ret->specifier==TS_ENUM)+ {+ ret->type=get_enum_type(ret);+ }else if(ret->specifier==TS_STRUCT || ret->specifier==TS_UNION)+ {+ ret->type=get_struct_union_type(ret);+ }else if(ret->type==NULL)+ {+ ret->type=get_basic_type(ret);+ }+ return ret;+ }+ }+ }+ }/*declaration-specifiers:( storage-class-specifier type-specifier type-qualifier function-specifier)* */- struct Denotation* parse_declaration_specifiers(struct Queue *tokens,struct Scope *scope)+ struct Denotation_Prototype* parse_declaration_specifiers(struct Queue *tokens,struct Scope *scope){enum KEYWORDS hold_kw;struct Denotation_Prototype *ret;chomp(tokens);if(ret->specifier!=TS_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->specifier=TS_INT;break;chomp(tokens);if(ret->specifier!=TS_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->specifier=TS_VOID;break;chomp(tokens);if(ret->specifier!=TS_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->specifier=TS_CHAR;break;chomp(tokens);if(ret->specifier!=TS_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->specifier=TS_DOUBLE;break;chomp(tokens);if(ret->specifier!=TS_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->specifier=TS_FLOAT;break;chomp(tokens);if(ret->constraint!=TC_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->constraint=TC_LONG;break;chomp(tokens);if(ret->constraint!=TC_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->constraint=TC_SHORT;break;chomp(tokens);if(ret->storage_class!=SC_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->storage_class=SC_EXTERN;break;chomp(tokens);if(ret->storage_class!=SC_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->storage_class=SC_STATIC;break;chomp(tokens);if(ret->storage_class!=SC_NONE){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}ret->storage_class=SC_TYPEDEF;break;ret->struct_union=tag->struct_union;if(ret->struct_union->specifier!=ret->specifier){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}}ret->enumerator=enumerator->enumeration;if(enumeration->enumeration->specifier!=TS_ENUM){- return get_denotation_prototype((struct Denoted*)ret);+ return get_denotation_error((struct Denoted*)ret);}}ret->enumeration=parse_enum_specifier_finish(tokens,scope);}break;+ case KW_ID:+ if(ret->specifier==TS_NONE)+ {+ struct Denoted *hold;+ hold=check_ordinary(scope,(struct token*)tokens->first.data);+ if(hold!=NULL && hold->denotation==DT_Typedef)+ {+ ret->type=((struct Denoted_Typedef*)hold)->type;+ chomp();+ break;+ }+ /*falltrough - this has not been typedefed*/+ }+ /*falltrough (it is possible to overwrite typedef id from upper scope)*/default:+ if(ret->specifier==TS_ENUM)+ {+ ret->type=get_enum_type(ret);+ }else if(ret->specifier==TS_STRUCT || ret->specifier==TS_UNION)+ {+ ret->type=get_struct_union_type(ret);+ }else if(ret->type==NULL)+ {+ ret->type=get_basic_type(ret);+ }return ret;}}declarator:( pointer ( type-qualifier )* )* direct-declarator*/- struct Denoted* parse_declarator(struct Queue *tokens,struct Scope *scope,struct Denotation_Prototype *prototype)+ struct Denoted* parse_declarator(struct Queue *tokens,struct Scope *scope,struct Denotation_Prototype *prototype,struct Location *where){- enum KEYWORDS hold;- struct Denotation_Prototype copy;-- copy=*prototype;- parse_declarator_inner(tokens,scope,©);- if(copy.type->specifier==TS_FUNC)+ struct Denoted_Base temp;+ temp.id=NULL;+ temp.denotation=DT_Prototype;+ temp.type=prototype->type;+ parse_declarator_inner(tokens,scope,&temp);+ if(temp.type->specifier==TS_FUNC)+ {+ if(temp.id==NULL)+ {+ return get_denotation_error(get_denoted_function(NULL,((struct Type_Function*)temp.type)->return_type,prototype->function_specifier));+ }else+ {+ return get_denotation_error(get_denoted_function(temp.id,((struct Type_Function*)temp.type)->return_type,prototype->function_specifier));+ }+ }else if(temp.type->specifier==TS_TYPEDEF)+ {+ if(temp.id==NULL)+ {+ return get_denoted_error(get_denoted_typedef(&temp));+ }else+ {+ return get_denoted_typedef(&temp);+ }+ }else{- return get_denoted_function(prototype);- }else if(copy.type->specifier==TS_TYPEDEF+ if(temp.id==NULL)+ {+ return get_denoted_error(get_denoted_object(temp.id,prototype->storage_class,where,temp.type));+ }else+ {+ return get_denoted_object(temp.id,prototype->storage_class,where,temp.type);+ }+ }- return ;}- void parse_declarator_inner(struct Queue *tokens,struct Scope *scope,struct Denotation_Prototype *copy)+ void parse_declarator_inner(struct Queue *tokens,struct Scope *scope,struct Denoted_Base *base){-+ enum KEYWORDS hold;while(get_and_check(tokens,KW_STAR)){- base=get_pointer_type(base);+ base->type=get_pointer_type(base->type);hold=kw_get(tokens);while(1){if(hold==KW_CONST){- base->is_const=1;+ (struct Type_Pointer*)(base->type)->is_const=1;}else if(hold==KW_VOLATILE){- base->is_volatile=1;+ (struct Type_Pointer*)(base->type)->is_volatile=1;}else{break;}}}+ parse_direct_declarator(tokens,scope,base);}/*id direct-declarator-finish( declarator ) direct-declarator-finish*/- void parse_direct_declarator(struct Queue *tokens,struct Scope *scope,struct Denotation_Prototype *prototype)+ void parse_direct_declarator(struct Queue *tokens,struct Scope *scope,struct Denoted_Base *base){- struct Denoted *hold;if(check(tokens,KW_ID)){- struct token *id;- id=Queue_Pop(tokens);- base=parse_direct_declarator_finish(tokens,scope,base);- switch(base->specifier)- {- case VOID:- case :- case VOID:- case VOID:- case VOID:- };+ base->id=Queue_Pop(tokens);+ parse_direct_declarator_finish(tokens,scope,base);}else if(get_and_check(tokens,KW_OPEN_NORMAL)){+ struct Queue *hack;+ hack=malloc(sizeof(struct Queue));+ Queue_Init(hack);+ while(!check(tokens,KW_CLOSE_NORMAL))+ {+ Queue_Push(hack,Queue_Pop(tokens));+ }+ /*remove closing )*/+ chomp(tokens);+ parse_direct_declarator_finish(tokens,scope,base);+ parse_declarator_inner(hack,scope,base);+ if(hack->size!=0)+ {+ /*TODO error*/+ while(hack->size)+ {+ free(Queue_Pop(hack));+ }+ free(hack);+ return;+ }+ free(hack);+}else{/*TODO error*/+ return;}}direct-declarator-finish:( [ constant-expression ] | (parameter-list) | ( [id-list] ) )**/- void parse_direct_declarator_finish(struct Queue *tokens,struct Scope *scope,struct Denotation_Prototype *prototype)+ void parse_direct_declarator_finish(struct Queue *tokens,struct Scope *scope,struct Denoted_Base *base){+ while(1)+ {+ if(get_and_check(tokens,KW_OPEN_SQUARE))+ {+ base->type=get_array_type(base->type,parse_expression(tokens,scope));+ if(!get_and_check(tokens,KW_CLOSE_NORMAL))+ {+ base->type=get_type_error(base->type);+ return;+ }+ }else if(get_and_check(tokens,KW_OPEN_NORMAL))+ {+ struct Queue *parameters;+ parameters=malloc(sizeof(struct Queue));+ Queue_Init(parameters);+ parse_paramenter_list(tokens,scope,parameters);+ base->type=get_function_type(base->type,parameters);++ }else+ {+ break;+ }++ }}*/struct Struct_Union* parse_struct_union_specifier_finish(struct Queue *tokens,struct Scope *scope){+ struct Struct_Union *ret;+ ret=get_struct_union_base();+ if(get_and_check(tokens,KW_OPEN_CURLY))+ {+ while(parse_struct_declaration(tokens,ret->inner_namespace,ret->members));+ if(get_and_check(tokens,KW_CLOSE_CURLY))+ {+ return ret;+ }else+ {+ /*TODO error*/+ return ret;+ }+++ }else+ {+ /*if this isnt a struct definition return an incomplete struct-union*/+ return ret;++ }}/*struct-declaration:specifier-qualifier-list ( struct-declarator )* ;*/- void parse_struct_declaration(struct Queue *tokens,struct Scope *struct_scope,struct Queue* members)+ char parse_struct_declaration(struct Queue *tokens,struct Scope *struct_scope,struct Queue* members){+ struct Denotation_Prototype *prototype;+ prototype=parse_specifier_qualifier_list(tokens,scope);}/**/void parse_paramenter_list(struct Queue *tokens,struct Scope *scope,struct Queue *parameters){-+}/*id-list:F diff --git a/semantics.c b/semantics.c --- a/semantics.c +++ b/semantics.c}break;}+ /*shouldnt reach here*/+ return 0;}F diff --git a/type.c b/type.c --- a/type.c +++ b/type.cstruct Struct_Union *ret;ret=malloc(sizeof(struct Struct_Union));ret->specifier=struct_or_union;- ret->number_of_members=0;- ret->members=NULL;- ret->inner_namespace=NULL;+ ret->members=malloc(sizeof(struct Queue));+ Queue_Init(ret->members);++ ret->inner_namespace=get_scope(NULL);return ret;}return (struct Type*)ret;}- struct Type* get_array_type(struct Type *is_array_of)+ struct Type* get_array_type(struct Type *is_array_of,struct AST* number_of_elements){struct Type_Array *ret;ret=malloc(sizeof(struct Type_Array));ret->specifier=TS_ARRAY;ret->size=0;- ret->number_of_elements=0;+ ret->number_of_elements=evaluate_const_expression_integer(number_of_elements);+ ret->expression=number_of_elements;+ ret->is_array_of=is_array_of;return (struct Type*)ret;}return (struct Type*)ret;}+ struct Type* get_function_type(struct Type* return_type,struct Queue *parameters)+ {+ struct Type_Function *ret;+ ret=malloc(sizeof(struct Type_Function));+ ret->specifier=TS_FUNC;+ ret->return_type=return_type;+ ret->parameters=parameters;++ return (struct Type*)ret;+ }#endifF diff --git a/type.h b/type.h --- a/type.h +++ b/type.h{enum Type_Specifier specifier;size_t size;- size_t number_of_members;- struct Denoted_Struct_Union_Member **members;+ struct Queue *members;struct Scope *inner_namespace;};struct Type_Bit_Fieldenum Type_Specifier specifier;size_t number_of_bits;struct Type *base;+ struct AST *expression;};struct Type_Basic{size_t size;size_t number_of_elements;struct Type *is_array_of;++ struct AST *expression;};struct Type_Function{enum Type_Specifier specifier;struct Type *return_type;+ struct Queue *parameters;- struct Denoted_Object **parameters;- size_t number_of_parameters;};struct Type_Enum{struct Enum *get_enum_base();struct Type* get_basic_type(struct Denotation_Prototype *prototype);struct Type* get_pointer_type(struct Type* points_to);- struct Type* get_array_type(struct Type *is_array_of);+ struct Type* get_array_type(struct Type *is_array_of,struct AST* number_of_elements);struct Type* get_enum_type(struct Denotation_Prototype *prototype);struct Type* get_type_bitfield(struct Type* base,size_t number_of_bits);+ struct Type* get_function_type(struct Type* return_type,struct Queue *parameters);