Done with helpers, need some function to actually print the tree and see for myself if it works wit simple symbols

This commit is contained in:
2026-03-24 21:51:28 -06:00
parent 7d28b69790
commit 17be815ed0

View File

@@ -1,5 +1,6 @@
#include "parser.h"
#include "lexer.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
@@ -37,7 +38,24 @@ uint8_t node_rbp(ASTNode node) {
}
}
ASTNode ASTNodeSlice_next(ASTNodeSlice *slice) {
return slice->arr->data[slice->pos++];
}
ASTNode ASTNodeSlice_peek(ASTNodeSlice *slice) {
return slice->arr->data[slice->pos];
}
bool ASTNodeSlice_is_valid(ASTNodeSlice *slice) {
if (slice->arr->len < 1) {
return false;
}
if (slice->pos >= slice->arr->len - 1) {
return false;
}
return true;
}
AST parse(ASTNodeArray *arr) {
AST tree;