From 27787308f298c8953ca1fcd066948211591edb6c Mon Sep 17 00:00:00 2001 From: LaEntropiaa Date: Tue, 24 Mar 2026 11:19:47 -0600 Subject: [PATCH] Read a pratt parsing article, i think i can do it, got nud and led the right way i think --- include/parser.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/parser.h b/include/parser.h index be689b0..b8f80f9 100644 --- a/include/parser.h +++ b/include/parser.h @@ -4,11 +4,14 @@ typedef struct { ASTNode *head; } AST; -typedef enum { - PARSER_NUD, // Null Denotation - PARSER_LED, // Left Denotation -} ParserState; +typedef struct { + ASTNodeArray *arr; + size_t pos; +} ASTNodeSlice; -size_t node_lbp(Operator op); -size_t node_rbp(Operator op); +ASTNode *nud(ASTNodeSlice *slice, size_t pos); +ASTNode *led(ASTNodeSlice *slice, size_t pos, size_t right_precedence); + +size_t node_lbp(ASTNode node); +size_t node_rbp(ASTNode node); AST parse(ASTNodeArray arr);