WOW, finally making some sense, i think i get it, finally got the skelleton, gonna keep reading for adding more interesting things and doing things right, for now i think i got the parse_expr

This commit is contained in:
2026-03-24 21:36:14 -06:00
parent acd5e9781e
commit 0d883ae978
2 changed files with 43 additions and 10 deletions

View File

@@ -1,4 +1,5 @@
#include "lexer.h"
#include <stdint.h>
typedef struct {
ASTNode *head;
@@ -9,13 +10,13 @@ typedef struct {
size_t pos;
} ASTNodeSlice;
ASTNode ASTNodeSlice_peek(ASTNodeSlice slice);
ASTNode ASTNodeSlice_next(ASTNodeSlice slice);
ASTNode ASTNodeSlice_peek(ASTNodeSlice *slice);
ASTNode ASTNodeSlice_next(ASTNodeSlice *slice);
ASTNode *nud(ASTNodeSlice *slice);
ASTNode *led(ASTNodeSlice *slice, size_t right_precedence);
size_t node_lbp(ASTNode node);
size_t node_rbp(ASTNode node);
uint8_t node_lbp(ASTNode node);
uint8_t node_rbp(ASTNode node);
AST parse(ASTNodeArray arr);
AST parse_expr(ASTNodeSlice *arr);
ASTNode *parse_expr(ASTNodeSlice *slice, uint8_t min_bp);