34 lines
740 B
C++
34 lines
740 B
C++
|
|
function void
|
|
bc_emit_expr(Bc *b, Ast *ast){
|
|
if(!ast) return;
|
|
if(!is_flag_set(ast->flags, AST_EXPR))
|
|
compiler_error(ast->pos, "Internal compiler error: Trying to emit expression but it doesn't have appropriate flag");
|
|
switch(ast->kind){
|
|
CASE(BINARY, Binary){
|
|
|
|
BREAK();
|
|
}
|
|
default:{}
|
|
}
|
|
}
|
|
|
|
function void
|
|
compile_to_bc(){
|
|
Bc bc = create_bytecode_interp();
|
|
Bc *b = &bc;
|
|
For_Named(pctx->ordered_decls, ast){
|
|
switch(ast->kind){
|
|
CASE(LAMBDA, Decl){
|
|
unused(node);
|
|
BREAK();
|
|
}
|
|
CASE(VAR, Decl){
|
|
node->bytecode_data_position = exp_alloc(&b->memory, node->type->size, AF_ZeroMemory);
|
|
bc_emit_assign(b, node);
|
|
BREAK();
|
|
}
|
|
default: {}
|
|
}
|
|
}
|
|
} |