aboutsummaryrefslogtreecommitdiff
path: root/demos/generate-parser.c
blob: b0a769d42a34153d4d85d19edb31d58c8a937f8b (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
#include <stdio.h>
#include <dlfcn.h>

#include <parts/table.h>

struct action **table;
size_t table_states;
size_t total_symbols;

int main(int argc, char **argv)
{
    if(argc != 2) return 1;
    
    void *handle = dlopen(argv[1], RTLD_LAZY);
    if(!handle) { puts(dlerror()); return 1; }
    
    table  = *(typeof(&table))dlsym(handle, "table");
    table_states = *(typeof(&table_states))dlsym(handle, "table_states");
    total_symbols = *(typeof(&total_symbols))dlsym(handle, "total_symbols");

    table_print();

    dlclose(handle);
    return 0;
}