F diff --git a/src/semantics/ast.c b/src/semantics/ast.c
--- a/src/semantics/ast.c
+++ b/src/semantics/ast.c
- /*TODO do this*/
- struct AST_Binary_Expression* get_array_subscript_tree(struct AST_Expression *left,struct AST_Expression *right)
+ struct AST_Binary_Expression* get_array_subscript_tree(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
{
-
+ struct Type *left_type;
+ struct Type *member_type;
+ struct AST_Binary_Expression *ret;
+
+ left_type=extract_expresion_value_type(left->value,translation_data);
+ if(left_type->specifier!=TS_POINTER)
+ {push_translation_error("expected pointer in array subscript",translation_data);return NULL;}
+
+ member_type=left_type->points_to;
+ if(!type_is_of_object(member_type))
+ {push_translation_error("expected pointer to object type in array subscript",translation_data);return NULL;}
+
+ ret=malloc(sizeof(struct AST_Binary_Expression));
+ ret->type=OP_ARR_SUBSCRIPT;
+ ret->value=get_expression_value_lvalue(get_temp_object(member_type));
+
+ ret->left=left;
+ ret->right=right;
+
+ return ret;
+
}
struct AST_Binary_Expression* get_struct_union_member_tree(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data)
{
}
struct AST_Binary_Expression* get_struct_union_member_trough_ptr_tree(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data)
{
-
+ struct Type *left_type;
+
+ left_type=extract_expresion_value_type(left->value,translation_data);
+ if(left_type->specifier!=TS_POINTER)
+ {push_translation_error("expected pointer in member trough ptr acess",translation_data);return NULL;}
+ left_type=left_type->points_to;
+ if(type_is_character
}
struct AST_Conditional_Expression* get_conditional_expression_tree(struct AST_Expression *left,struct AST_Expression *center,struct AST_Expression *right)
F diff --git a/src/semantics/ast.h b/src/semantics/ast.h
--- a/src/semantics/ast.h
+++ b/src/semantics/ast.h
struct AST_Binary_Expression* get_binary_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type type);
- struct AST_Binary_Expression* get_array_subscript_tree(struct AST_Expression *left,struct AST_Expression *right);
+ struct AST_Binary_Expression* get_array_subscript_tree(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data);
struct AST_Binary_Expression* get_struct_union_member_tree(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data);
struct AST_Binary_Expression* get_struct_union_member_trough_ptr_tree(struct AST_Expression *left,struct token *id,struct Translation_Data *translation_data);
F diff --git a/src/semantics/memory/object.c b/src/semantics/memory/object.c
--- a/src/semantics/memory/object.c
+++ b/src/semantics/memory/object.c
void delete_object(struct Object *object)
{
- if(object->location!=NULL)
- delete_location(object->location);
free(object);
}