Starting with the lexer, i'm starting to comprehend better what pratt parsing is and how to apply it. For now just declaring basic structure and functions
This commit is contained in:
@@ -73,5 +73,6 @@ LexerErr tokenize(const char* input, ASTNodeArray *out);
|
||||
LexerErr tokenize_number(const char* input, size_t *offset, ASTNode *out);
|
||||
LexerErr string_to_integer(const char buf[], int64_t *number);
|
||||
bool isoperator(int c);
|
||||
Operator char_to_operator(int c);
|
||||
|
||||
#endif // !LEXER_H
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "lexer.h"
|
||||
|
||||
typedef struct {
|
||||
ASTNode *head;
|
||||
} AST;
|
||||
|
||||
typedef enum {
|
||||
PARSER_NUD, // Null Denotation
|
||||
PARSER_LED, // Left Denotation
|
||||
} ParserState;
|
||||
|
||||
size_t node_lbp(Operator op);
|
||||
size_t node_rbp(Operator op);
|
||||
AST parse(ASTNodeArray arr);
|
||||
|
||||
Reference in New Issue
Block a user