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:
2026-05-25 10:33:29 +01:00
parent 58c76a1f57
commit edfb3e24a3
165 changed files with 5173 additions and 4995 deletions
+40
View File
@@ -0,0 +1,40 @@
#include "compile-node.h"
#include <bshell/ast.h>
#include <bshell/compile.h>
#include <bshell/status.h>
extern enum bshell_status compile_node(
struct compile_ctx *ctx,
struct bshell_ast_node *src)
{
switch (src->n_type) {
case BSHELL_AST_IF:
return compile_if(ctx, src);
case BSHELL_AST_BLOCK:
return compile_block_immediate(ctx, src);
default:
return compile_expression(ctx, src);
}
return BSHELL_SUCCESS;
}
enum bshell_status bshell_compile(
struct bshell_ast_node *src,
bshell_scriptblock *dest)
{
struct compile_ctx ctx = {.c_block = dest};
enum bshell_status status = compile_node(&ctx, src);
if (status != BSHELL_SUCCESS) {
return status;
}
status = compile_resolve_labels(&ctx);
if (status != BSHELL_SUCCESS) {
return status;
}
return BSHELL_SUCCESS;
}