aboutsummaryrefslogtreecommitdiffstats
path: root/src/parser.h
blob: 3c2dc2b897039581473a6b54406f487e4edf5251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef BDL_PARSER_H
#define BDL_PARSER_H

#include "lexer.h"
#include "nodes.h"
#include "hashtable.h"

typedef struct Scope {
    struct Scope *parent;
    HashTable *symbols;
    // HashTable types;
} Scope;

typedef struct ParseTree {
    Node **roots;
    Scope *global_scope;
    Scope *current_scope;
} ParseTree;

typedef struct Parser {
    Token *tokens;
    size_t current_token;
    ParseTree *parse_tree;
} Parser;

ParseTree * parse(Token *tokens);
Node * parse_next(Parser *parser);

#endif // BDL_PARSER_H