expand eval machine interpretation error codes; visualize

This commit is contained in:
Ryan Fleury
2024-02-08 10:28:41 -08:00
parent fed0a13aca
commit 95a6579f89
7 changed files with 118 additions and 35 deletions
+28
View File
@@ -54,6 +54,22 @@ EVAL_ExprKindTable:
{ LeafIdent 0 "leaf_ident" }
}
@table(name display_string)
EVAL_ResultCodeTable:
{
{ Good "" }
{ DivideByZero "Cannot divide by zero." }
{ BadOp "Invalid operation." }
{ BadOpTypes "Invalid operation types." }
{ BadMemRead "Failed memory read." }
{ BadRegRead "Failed register read." }
{ BadFrameBase "Invalid frame base address." }
{ BadModuleBase "Invalid module base address." }
{ BadTLSBase "Invalid thread-local storage base address." }
{ InsufficientStackSpace "Insufficient evaluation machine stack space." }
{ MalformedBytecode "Malformed bytecode." }
}
@table_gen
{
`typedef U32 EVAL_ExprKind;`;
@@ -65,6 +81,12 @@ EVAL_ExprKindTable:
``;
}
@table_gen_enum EVAL_ResultCode:
{
@expand(EVAL_ResultCodeTable a) `EVAL_ResultCode_$(a.name),`;
EVAL_ResultCode_COUNT
}
@table_gen_data(type:U8, fallback:0)
eval_expr_kind_child_counts:
{
@@ -77,6 +99,12 @@ eval_expr_kind_strings:
@expand(EVAL_ExprKindTable a) `str8_lit_comp("$(a.name)"),`;
}
@table_gen_data(type:String8, fallback:`{0}`)
eval_result_code_display_strings:
{
@expand(EVAL_ResultCodeTable a) `str8_lit_comp("$(a.display_string)"),`;
}
@table_gen_data(type:String8, fallback:`{0}`)
eval_expr_op_strings:
{