| Completed | Static symbol resolution where order does not matter |
| Completed | Link to externally defined functions (WASM imports) |
| Completed | Standard C-style control flow |
-| Not Started | Global variables (WASM globals) |
+| In Progress | Global variables (WASM globals) |
| Not Started | Pointers |
| Not Started | Structured data |
// Top-level flags
ONYX_AST_FLAG_EXPORTED = BH_BIT(0),
ONYX_AST_FLAG_LVAL = BH_BIT(1),
- ONYX_AST_FLAG_CONST = BH_BIT(2),
+ ONYX_AST_FLAG_CONST = BH_BIT(2),
ONYX_AST_FLAG_COMPTIME = BH_BIT(3),
} OnyxAstFlags;
let s:cpo_save = &cpo
set cpo&vim
-syn keyword onyxKeyword struct proc use export foreign global
+syn keyword onyxKeyword struct proc use export foreign
syn keyword onyxKeyword if elseif else
syn keyword onyxKeyword for while loop return do
-syn keyword onyxKeyword return
+syn keyword onyxKeyword break continue return
syn keyword onyxKeyword as
syn keyword onyxType i32
export main :: proc {
+ while true {
+ print(8000);
+ break;
+ }
+
x := 0;
while x < 10 {
return 100 * n;
}
+// symbol :: proc {} Global function
+// symbol :: struct { x i32, y i32 }
+// symbol :: foreign "" "" proc Global foreign function
+// symbol :: foreign "" "" i32 Global foreign mutable i32
+// symbol :: 5 Global constant value
+// symbol := 5 Global mutable variable
+// symbol : i32 Global mutable i32 (defaults to 0 initial value)
+
// This is the entry point
export main :: proc {
i := 0;
}
bh_printf("Checking semantics and types\n");
- OnyxSemPassState sp_state = onyx_sempass_create( compiler_state->sp_alloc, compiler_state->ast_alloc, &compiler_state->msgs);
+ OnyxSemPassState sp_state = onyx_sempass_create(compiler_state->sp_alloc, compiler_state->ast_alloc, &compiler_state->msgs);
onyx_sempass(&sp_state, root_file);
if (onyx_message_has_errors(&compiler_state->msgs)) {
}
void compiler_state_free(CompilerState* cs) {
- // NOTE: There is a memory leak here because the token's aren't freed
-
bh_arena_free(&cs->ast_arena);
bh_arena_free(&cs->msg_arena);
bh_arena_free(&cs->sp_arena);
compiler_state_free(&compile_state);
+ bh_managed_heap_free(&global_heap);
+
return compiler_progress != ONYX_COMPILER_PROGRESS_SUCCESS;
}
}
// NOTE: This returns a void* so I don't need to cast it everytime I use it
-void* onyx_ast_node_new(bh_allocator alloc, OnyxAstNodeKind kind) {\
+void* onyx_ast_node_new(bh_allocator alloc, OnyxAstNodeKind kind) {
OnyxAstNode* node = bh_alloc_item(alloc, OnyxAstNode);
node->kind = kind;
node->flags = 0;