F diff --git a/src/frontend/parse/.parse_expression.c.swp b/src/frontend/parse/.parse_expression.c.swp
deleted file mode 100644
B Binary files a/src/frontend/parse/.parse_expression.c.swp and /dev/null differ
F diff --git a/src/semantics/ast.c b/src/semantics/ast.c
--- a/src/semantics/ast.c
+++ b/src/semantics/ast.c
}
/*TODO*/
- struct AST_Binary_Expression* get_assignment_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ struct AST_Binary_Expression* get_simple_assignment_expression_tree(struct AST_Expression *left,struct AST_Expression *right,struct Translation_Data *translation_data)
{
- struct
- if(left->value->type!=VALUE_LVALUE)
+ struct Expression_Value_LValue *left_value;
+ struct Type *left_type;
+ struct Type *right_type;
+
+ left_value=left->value;
+ left_type=extract_expresion_value_type(left->value);
+ right_type=extract_expresion_value_type(right->value);
+
+ if(left_value->type!=VALUE_LVALUE || !type_is_complete(left_type) || !left_value->is_modifiable)
{
- push_translation_error("expected lvalue in left operand of assignment expression",translation_data);
+ push_translation_error("expected modifiable lvalue in left operand of assignment expression",translation_data);
return get_error_tree(get_binary_expression_tree(left,right,operation));
}else
{
- return get_binary_expression_tree(left,right,get_temp
+ int flag=0;
+ flag=(type_is_arithmetic(left_type) && type_is_arithmetic(right_type));
+ flag|=(type_is_struct_union(left_type) && types_are_compatible(left_type,right_type));
+ flag|=(left_type->specifier==TS_POINTER && types_are_compatible(left_type,right_type));
+ /*TODO add ( pointer void ) ( _Bool pointer )*/
+
+ if(!flag)
+ {
+ left_type=get_unqualified_version_of_type(left_type);
+ right=get_cast_expression_tree(right,left_type,translation_data);
+ return get_binary_expression_tree(left,right,get_expression_value_rvalue(get_temp_object(left_type)),OP_ASSIGN);
+ }else
+ {
+ push_translation_error("in assignment expression",translation_data);
+ return get_error_tree(get_binary_expression_tree(left,right,operation));
+ }
}
}
+ struct AST_Binary_Expression* get_compound_assignment_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data)
+ {
+
+ }
struct AST_Binary_Expression* get_binary_expression_after_conversion(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type type,struct Translation_Data *translation_data)
{
struct Type_Basic *left_type;
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_bitwise_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
struct AST_Binary_Expression* get_equality_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
struct AST_Binary_Expression* get_logical_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
- struct AST_Binary_Expression* get_assignment_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+
+ struct AST_Binary_Expression* get_simple_assignment_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+ struct AST_Binary_Expression* get_compound_assignment_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
+
+
struct AST_Binary_Expression* get_comma_expression_tree(struct AST_Expression *left,struct AST_Expression *right,enum AST_Type operation,struct Translation_Data *translation_data);
F diff --git a/src/semantics/value/type.c b/src/semantics/value/type.c
--- a/src/semantics/value/type.c
+++ b/src/semantics/value/type.c
}
+ char types_are_compatible(struct Type *a,struct Type *b)
+ {
+ return 1;
+ }
char type_is_scalar(struct Type *type)
{
}
}
+ char type_is_qualified(struct Type *type)
+ {
+ return 1;
+ }
struct Type* get_type_for_promotion(struct Type *type,struct Translation_Data *translation_data)
{
if(type->specifier==TS_CHAR)
}
/*TODO*/
+ struct Type* get_unqualified_version_of_type(struct Type *type)
+ {
+ return type;
+ }
+ /*TODO*/
int type_get_integer_conversion_rank(struct Type_Basic *type)
{
switch(type->specifier)
F diff --git a/src/semantics/value/type.h b/src/semantics/value/type.h
--- a/src/semantics/value/type.h
+++ b/src/semantics/value/type.h
struct Type* get_type_insecure(enum Type_Specifier type_specifier,enum Type_Signedness sign,enum Type_Constraint constraint,size_t type_size,struct Translation_Data *translation_data);
struct Type* get_type_for_promotion(struct Type *type,struct Translation_Data *translation_data);
+ struct Type* get_unqualified_version_of_type(struct Type *type);
void delete_enum(struct Enum *enumeration);
void delete_struct_union(struct Struct_Union *su);
char types_are_identical(struct Type *a,struct Type *b);
+ char types_are_compatible(struct Type *a,struct Type *b);
char type_is_of_object(struct Type *type);
char type_is_complete(struct Type *type);
char type_is_aggregate(struct Type *type);
char type_is_struct_union(struct Type *type);
char type_is_constant_or_has_constant_member(struct Type *type);
+ char type_is_qualified(struct Type *type);
int type_get_integer_conversion_rank(struct Type_Basic *type);