42 lines
599 B
C
42 lines
599 B
C
|
|
#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);
|
||
|
|
}
|