Read a pratt parsing article, i think i can do it, got nud and led the right way i think

This commit is contained in:
2026-03-24 11:19:47 -06:00
parent 6377515558
commit 27787308f2

View File

@@ -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);