Item collection building returns the collection
[cascardo/grammar.git] / lr0.h
1 #ifndef LR0_H
2 #define LR0_H
3
4 #include "parser.h"
5
6 typedef enum
7   {
8     PARSER_SHIFT,
9     PARSER_REDUCE,
10     PARSER_ACCEPT,
11   } action_t;
12
13 typedef struct
14 {
15   gint state;
16   gpointer attrib;
17 } state_t;
18
19 typedef struct
20 {
21   gint action;
22   gint state;
23 } transition_t;
24
25 typedef struct
26 {
27   nextcb cb;
28   gpointer data;
29   GList* stack;
30   GHashTable* table;
31   GList* rules;
32 } lr0_t;
33
34 transition_t* transition_new (gint, gint);
35 lr0_t* lr0_new (nextcb, gpointer);
36 void lr0_delete (lr0_t*);
37 void lr0_add (lr0_t*, gint, symbol_t*, transition_t*);
38 gpointer lr0_build (lr0_t*);
39
40 #endif