bshell: re-organise build into three separate components
bshell: the front-end binary bshell.runtime: contains the parser, compiler, and classes needed to run bshell scripts bshell.core: contains the builtin commandlets and aliases
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#include "compile-node.h"
|
||||
|
||||
static const struct compile_value_type array_type = {};
|
||||
static const struct compile_value_type array_item_type = {};
|
||||
|
||||
struct compile_result compile_array(
|
||||
struct compile_ctx *ctx,
|
||||
struct bshell_ast_node *src)
|
||||
{
|
||||
struct bshell_array_ast_node *array;
|
||||
array = (struct bshell_array_ast_node *)src;
|
||||
size_t nr_items = fx_queue_length(&array->n_items);
|
||||
for (size_t i = 0; i < nr_items; i++) {
|
||||
struct compile_value *item = compile_pop_value(ctx);
|
||||
compile_value_load(ctx, item);
|
||||
compile_value_destroy(item);
|
||||
}
|
||||
|
||||
bshell_scriptblock_push_instruction(
|
||||
ctx->c_block,
|
||||
BSHELL_OPCODE_MK_ARRAY,
|
||||
nr_items);
|
||||
compile_push_value(ctx, &array_type, src);
|
||||
return COMPILE_OK(0);
|
||||
}
|
||||
Reference in New Issue
Block a user