aboutsummaryrefslogtreecommitdiff
path: root/parts/symbol.h
blob: 2190eca496a859499ed4793f1a17c9c0bb4b5dfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef SYMBOL_H
#define SYMBOL_H

#include <stddef.h> // size_t

typedef unsigned int symbol;
extern size_t total_symbols;
extern char **symbol_to_str;

extern int (*symbol_is_terminal)(symbol s);
extern int (*symbol_is_input_end)(symbol s);
extern int (*symbol_is_valid)(symbol s);

// helper macro
#define IMPLEMENT_FUNCPTR(type, name, args)  \
    type __##name args;                      \
    type (*name) args = __##name;            \
    type __##name args

#endif