libsapling  0.8.0
Typedefs | Enumerations | Functions
action_table.h File Reference

Parser action table implementation. More...

#include "libsapling/dm/graph.h"
#include "libsapling/cc/parser/grammar.h"

Go to the source code of this file.

Typedefs

typedef struct action_table * action_table_t
 

Enumerations

enum  { PARSER_ACTION_ERROR , PARSER_ACTION_SHIFT , PARSER_ACTION_REDUCE , PARSER_ACTION_ACCEPT }
 

Functions

action_table_t action_table__build (grammar_t g, node_t *C)
 Builds the action table. More...
 
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. More...
 
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. More...
 
action_table_t new_action_table (grammar_t g, node_t *C)
 Allocates memory for an action table on the heap. More...
 
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. More...
 
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. More...
 

Detailed Description

Parser action table implementation.

Function Documentation

◆ action_table__build()

action_table_t action_table__build ( grammar_t  g,
node_t *  C 
)

Builds the action table.

Parameters
gA grammar
CA set of sets of LR(0) item

◆ action_table__get_action()

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.

Parameters
tblThe action table
gThe grammar that was used to build the table
stateThe state
symThe terminal symbol

◆ action_table__get_action_info()

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.

Parameters
tblThe action table
gThe grammar that was used to build the table
stateThe state
symThe terminal symbol

◆ action_table__set_action()

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.

Parameters
tblThe action table
gThe grammar
stateThe state
symThe terminal symbol
actionThe action
Attention
This method was written for testing purposes.

◆ action_table__set_action_info()

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.

Parameters
tblThe action table
gThe grammar
stateThe state
symThe terminal symbol
action_infoThe action information
Attention
This method was written for testing purposes.

◆ new_action_table()

action_table_t new_action_table ( grammar_t  g,
node_t *  C 
)

Allocates memory for an action table on the heap.

Parameters
gA grammar
CA set of sets of LR(0) item
Attention
This method was written for testing purposes.