aboutsummaryrefslogtreecommitdiff
path: root/parts/grammar.h
blob: 328f88e9139f22c57bbe4758f6c0f7f3ead134c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef GRAMMAR_H
#define GRAMMAR_H

extern struct production {
    symbol LHS;
    symbol *RHS;
    size_t nRHS;
} grammar[];

extern const size_t total_productions;

void grammar_print()
{
    for(size_t i = 0; i < total_productions; i++) {
        printf("%d --> ", grammar[i].LHS);
        for(size_t j = 0; j < grammar[i].nRHS; j++)
            printf("%d ", grammar[i].RHS[j]);
        printf("\n");
    }
}

#endif