3 static struct position
get_cur_pos(void)
5 static struct position pos
;
6 static struct position none
;
7 struct expression
*expr
;
8 struct statement
*stmt
;
10 expr
= last_ptr_list((struct ptr_list
*)big_expression_stack
);
11 stmt
= last_ptr_list((struct ptr_list
*)big_statement_stack
);
21 struct expression
*zero_expr(void)
23 static struct expression
*zero
;
28 zero
= alloc_expression(get_cur_pos(), EXPR_VALUE
);
30 zero
->ctype
= &char_ctype
;
34 struct expression
*value_expr(long long val
)
36 struct expression
*expr
;
41 expr
= alloc_expression(get_cur_pos(), EXPR_VALUE
);
43 expr
->ctype
= &llong_ctype
;
47 struct expression
*member_expression(struct expression
*deref
, int op
, struct ident
*member
)
49 struct expression
*expr
;
51 expr
= alloc_expression(deref
->pos
, EXPR_DEREF
);
54 expr
->member
= member
;
58 struct expression
*deref_expression(struct expression
*expr
)
60 struct expression
*preop
;
62 preop
= alloc_expression(expr
->pos
, EXPR_PREOP
);
68 struct expression
*assign_expression(struct expression
*left
, struct expression
*right
)
70 struct expression
*expr
;
72 expr
= alloc_expression(right
->pos
, EXPR_ASSIGNMENT
);
79 struct expression
*binop_expression(struct expression
*left
, int op
, struct expression
*right
)
81 struct expression
*expr
;
83 expr
= alloc_expression(right
->pos
, EXPR_BINOP
);
90 struct expression
*array_element_expression(struct expression
*array
, struct expression
*offset
)
92 struct expression
*expr
;
94 expr
= binop_expression(array
, '+', offset
);
95 return deref_expression(expr
);
98 struct expression
*symbol_expression(struct symbol
*sym
)
100 struct expression
*expr
;
102 expr
= alloc_expression(sym
->pos
, EXPR_SYMBOL
);
104 expr
->symbol_name
= sym
->ident
;
108 struct expression
*compare_expression(struct expression
*left
, int op
, struct expression
*right
)
110 struct expression
*expr
;
112 expr
= alloc_expression(get_cur_pos(), EXPR_COMPARE
);