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; ASTNode *head;
} AST; } AST;
typedef enum { typedef struct {
PARSER_NUD, // Null Denotation ASTNodeArray *arr;
PARSER_LED, // Left Denotation size_t pos;
} ParserState; } ASTNodeSlice;
size_t node_lbp(Operator op); ASTNode *nud(ASTNodeSlice *slice, size_t pos);
size_t node_rbp(Operator op); 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); AST parse(ASTNodeArray arr);