feat: yet another new parser architecture

This commit is contained in:
Gu://em_ 2026-01-23 17:01:26 +01:00
parent 6dd19a75ad
commit 96ac2fea77
9 changed files with 182 additions and 128 deletions

41
src/parser/grammar.c Normal file
View file

@ -0,0 +1,41 @@
#define _POSIX_C_SOURCE 200809L
// === Includes
#include "grammar.h"
#include "../utils/hash_map/hash_map.h"
#include "grammar_basic.h"
// === Static variables
static struct hash_map *firsts_map = NULL;
// === Static functions
static enum token_type first(enum rule r)
{
// TODO
return TOKEN_NULL;
}
// === Functions
bool grammar_init(void)
{
// Create firsts hashmap
// TODO
// Populate the hashmap
// TODO
return true;
}
void grammar_close(void)
{
// TODO free hashmap
}
struct ast *parse_input(struct lexer_context *ctx)
{
return parse_list(ctx);
}