+bool ast_store_codegen(ast_store*, ast_function*, bool lvalue, ir_value**);
+
+/* If
+ *
+ * A general 'if then else' statement, either side can be NULL and will
+ * thus be omitted. It is an error for *both* cases to be NULL at once.
+ *
+ * During its 'codegen' it'll be changing the ast_function's block.
+ *
+ * An if is also an "expression". Its codegen will put NULL into the
+ * output field though. For ternary expressions an ast_ternary will be
+ * added.
+ */
+struct ast_ifthen_s
+{
+ ast_expression_common expression;
+ ast_expression *cond;
+ /* It's all just 'expressions', since an ast_block is one too. */
+ ast_expression *on_true;
+ ast_expression *on_false;
+};
+ast_ifthen* ast_ifthen_new(lex_ctx ctx, ast_expression *cond, ast_expression *ontrue, ast_expression *onfalse);
+void ast_ifthen_delete(ast_ifthen*);
+
+bool ast_ifthen_codegen(ast_ifthen*, ast_function*, bool lvalue, ir_value**);
+
+/* Ternary expressions...
+ *
+ * Contrary to 'if-then-else' nodes, ternary expressions actually
+ * return a value, otherwise they behave the very same way.
+ * The difference in 'codegen' is that it'll return the value of
+ * a PHI node.
+ *
+ * The other difference is that in an ast_ternary, NEITHER side
+ * must be NULL, there's ALWAYS an else branch.
+ *
+ * This is the only ast_node beside ast_value which contains
+ * an ir_value. Theoretically we don't need to remember it though.
+ */
+struct ast_ternary_s
+{
+ ast_expression_common expression;
+ ast_expression *cond;
+ /* It's all just 'expressions', since an ast_block is one too. */
+ ast_expression *on_true;
+ ast_expression *on_false;
+};
+ast_ternary* ast_ternary_new(lex_ctx ctx, ast_expression *cond, ast_expression *ontrue, ast_expression *onfalse);
+void ast_ternary_delete(ast_ternary*);
+
+bool ast_ternary_codegen(ast_ternary*, ast_function*, bool lvalue, ir_value**);
+
+/* A general loop node
+ *
+ * For convenience it contains 4 parts:
+ * -) (ini) = initializing expression
+ * -) (pre) = pre-loop condition
+ * -) (pst) = post-loop condition
+ * -) (inc) = "increment" expression
+ * The following is a psudo-representation of this loop
+ * note that '=>' bears the logical meaning of "implies".
+ * (a => b) equals (!a || b)
+
+{ini};
+while (has_pre => {pre})
+{
+ {body};
+
+continue: // a 'continue' will jump here
+ if (has_pst => {pst})
+ break;
+
+ {inc};
+}
+ */
+struct ast_loop_s
+{
+ ast_expression_common expression;
+ ast_expression *initexpr;
+ ast_expression *precond;
+ ast_expression *postcond;
+ ast_expression *increment;
+ ast_expression *body;
+};
+ast_loop* ast_loop_new(lex_ctx ctx,
+ ast_expression *initexpr,
+ ast_expression *precond,
+ ast_expression *postcond,
+ ast_expression *increment,
+ ast_expression *body);
+void ast_loop_delete(ast_loop*);
+
+bool ast_loop_codegen(ast_loop*, ast_function*, bool lvalue, ir_value**);
+
+/* Break/Continue
+ */
+struct ast_breakcont_s
+{
+ ast_expression_common expression;
+ bool is_continue;
+};
+ast_breakcont* ast_breakcont_new(lex_ctx ctx, bool iscont);
+void ast_breakcont_delete(ast_breakcont*);
+
+bool ast_breakcont_codegen(ast_breakcont*, ast_function*, bool lvalue, ir_value**);
+
+/* Switch Statements
+ *
+ * A few notes about this: with the original QCVM, no real optimization
+ * is possible. The SWITCH instruction set isn't really helping a lot, since
+ * it only collapes the EQ and IF instructions into one.
+ * Note: Declaring local variables inside caseblocks is normal.
+ * Since we don't have to deal with a stack there's no unnatural behaviour to
+ * be expected from it.
+ * TODO: Ticket #20
+ */
+typedef struct {
+ ast_expression *value; /* #20 will replace this */
+ ast_expression *code;
+} ast_switch_case;
+struct ast_switch_s
+{
+ ast_expression_common expression;
+
+ ast_expression *operand;
+ ast_switch_case *cases;
+};
+
+ast_switch* ast_switch_new(lex_ctx ctx, ast_expression *op);
+void ast_switch_delete(ast_switch*);
+
+bool ast_switch_codegen(ast_switch*, ast_function*, bool lvalue, ir_value**);
+
+/* Label nodes
+ *
+ * Introduce a label which can be used together with 'goto'
+ */
+struct ast_label_s
+{
+ ast_expression_common expression;
+ const char *name;
+ ir_block *irblock;
+ ast_goto **gotos;
+};
+
+ast_label* ast_label_new(lex_ctx ctx, const char *name);
+void ast_label_delete(ast_label*);
+void ast_label_register_goto(ast_label*, ast_goto*);
+
+bool ast_label_codegen(ast_label*, ast_function*, bool lvalue, ir_value**);
+
+/* GOTO nodes
+ *
+ * Go to a label, the label node is filled in at a later point!
+ */
+struct ast_goto_s
+{
+ ast_expression_common expression;
+ const char *name;
+ ast_label *target;
+ ir_block *irblock_from;
+};
+
+ast_goto* ast_goto_new(lex_ctx ctx, const char *name);
+void ast_goto_delete(ast_goto*);
+void ast_goto_set_label(ast_goto*, ast_label*);
+
+bool ast_goto_codegen(ast_goto*, ast_function*, bool lvalue, ir_value**);
+
+/* CALL node
+ *
+ * Contains an ast_expression as target, rather than an ast_function/value.
+ * Since it's how QC works, every ast_function has an ast_value
+ * associated anyway - in other words, the VM contains function
+ * pointers for every function anyway. Thus, this node will call
+ * expression.
+ * Additionally it contains a list of ast_expressions as parameters.
+ * Since calls can return values, an ast_call is also an ast_expression.
+ */
+struct ast_call_s
+{
+ ast_expression_common expression;
+ ast_expression *func;
+ ast_expression* *params;
+};
+ast_call* ast_call_new(lex_ctx ctx,
+ ast_expression *funcexpr);
+void ast_call_delete(ast_call*);
+bool ast_call_codegen(ast_call*, ast_function*, bool lvalue, ir_value**);
+bool ast_call_check_types(ast_call*);