libsapling  0.8.0
action_table.h
Go to the documentation of this file.
1 #ifndef _LIBSAPLING_PARSER_ACTION_TABLE_H_
2 #define _LIBSAPLING_PARSER_ACTION_TABLE_H_
3 
9 #include "libsapling/dm/graph.h"
11 
12 
13 typedef struct action_table *action_table_t;
14 
15 
16 enum {
17  PARSER_ACTION_ERROR,
18  PARSER_ACTION_SHIFT,
19  PARSER_ACTION_REDUCE,
20  PARSER_ACTION_ACCEPT
21 };
22 
29 action_table_t action_table__build(grammar_t g, node_t *C);
30 
40 int action_table__get_action(action_table_t tbl, grammar_t g, int state,
41  int sym);
42 
52 int action_table__get_action_info(action_table_t tbl, grammar_t g, int state,
53  int sym);
54 
63 action_table_t new_action_table(grammar_t g, node_t *C);
64 
76 void action_table__set_action(action_table_t tbl, grammar_t g, int state,
77  int sym, int action);
78 
91 void action_table__set_action_info(action_table_t tbl, grammar_t g, int state,
92  int sym, int action_info);
93 
94 #endif
void action_table__set_action(action_table_t tbl, grammar_t g, int state, int sym, int action)
Sets the parser action to perform on a particular state and terminal.
int action_table__get_action(action_table_t tbl, grammar_t g, int state, int sym)
Returns the parser action to perform on a particular state and terminal.
action_table_t new_action_table(grammar_t g, node_t *C)
Allocates memory for an action table on the heap.
int action_table__get_action_info(action_table_t tbl, grammar_t g, int state, int sym)
Returns the parser action information on a particular state and terminal.
void action_table__set_action_info(action_table_t tbl, grammar_t g, int state, int sym, int action_info)
Sets the parser action information on a particular state and terminal.
action_table_t action_table__build(grammar_t g, node_t *C)
Builds the action table.
Grammar implementation.
Graph implementation.