diff options
| author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2026-05-16 10:59:21 +0200 |
|---|---|---|
| committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2026-05-16 10:59:21 +0200 |
| commit | d86f31325ca1343355f81918f0ad449f8788baa1 (patch) | |
| tree | 277f2a324bd0f6b3d85ba4df693c05722934badf /lib/aplwc_internal.h | |
| parent | 3b0ed8d3296efd16e422e66168dab66399f60776 (diff) | |
Commit work in progress changes
Diffstat (limited to 'lib/aplwc_internal.h')
| -rw-r--r-- | lib/aplwc_internal.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/aplwc_internal.h b/lib/aplwc_internal.h index dd676fb..44785ed 100644 --- a/lib/aplwc_internal.h +++ b/lib/aplwc_internal.h @@ -22,6 +22,7 @@ #define APLWC_INTERNAL_H #include <stdarg.h> +#include <stdint.h> #include <stdbool.h> enum aplwc_token_tag { @@ -37,6 +38,12 @@ enum aplwc_ast_tag { APLWC_AST_ERROR, }; +enum aplwc_instr_tag { + APLWC_INSTR_SYSCMD_CALL, + APLWC_INSTR_ERROR, + APLWC_INSTR_END, +}; + struct aplwc { void *(*alloc)(size_t); void (*free)(void *); @@ -58,6 +65,8 @@ struct aplwc_eval_context { size_t token_offset; struct aplwc_ast *ast; + + struct aplwc_instrs *instrs; }; struct aplwc_token { @@ -80,15 +89,29 @@ struct aplwc_ast { } data; }; +struct aplwc_instrs { + size_t n_instrs; + uint64_t *instrs; +}; + +struct aplwc_instr { + int type; + enum aplwc_instr_tag op; + + uint64_t encoded; +}; struct aplwc_syscmd *aplwc_lookup_syscmd(struct aplwc *, const char *); struct aplwc_eval_context *aplwc_new_eval_context(struct aplwc *); void aplwc_scan_line(struct aplwc_eval_context *, const char *); void aplwc_parse(struct aplwc_eval_context *); +void aplwc_compile(struct aplwc_eval_context *); void aplwc_eval(struct aplwc_eval_context *); void aplwc_free_eval_context(struct aplwc_eval_context *); void aplwc_free_ast(struct aplwc *, struct aplwc_ast *); char *aplwc_strdup(struct aplwc *, const char *); void aplwc_output(struct aplwc *, const char *, ...); void aplwc_voutput(struct aplwc *, const char *, va_list); - +void aplwc_encode_instr(struct aplwc_instr *); +void aplwc_decode_instr(struct aplwc_instr *); + #endif /* APLWC_INTERNAL_H */ |