version 1.18, 2014/03/13 00:59:34 |
version 1.19, 2017/05/25 20:11:03 |
|
|
static int SRcount; |
static int SRcount; |
static int RRcount; |
static int RRcount; |
|
|
extern action *parse_actions(); |
extern action *parse_actions(int); |
extern action *get_shifts(); |
extern action *get_shifts(int); |
extern action *add_reductions(); |
extern action *add_reductions(int, action *); |
extern action *add_reduce(); |
extern action *add_reduce(action *, int, int); |
|
|
short sole_reduction(int); |
short sole_reduction(int); |
void free_action_row(action *); |
void free_action_row(action *); |
|
|
{ |
{ |
action *actions, *temp; |
action *actions, *temp; |
shifts *sp; |
shifts *sp; |
short *to_state; |
short *tto_state; |
int i, k; |
int i, k; |
int symbol; |
int symbol; |
|
|
actions = 0; |
actions = 0; |
sp = shift_table[stateno]; |
sp = shift_table[stateno]; |
if (sp) { |
if (sp) { |
to_state = sp->shift; |
tto_state = sp->shift; |
for (i = sp->nshifts - 1; i >= 0; i--) { |
for (i = sp->nshifts - 1; i >= 0; i--) { |
k = to_state[i]; |
k = tto_state[i]; |
symbol = accessing_symbol[k]; |
symbol = accessing_symbol[k]; |
if (ISTOKEN(symbol)) { |
if (ISTOKEN(symbol)) { |
temp = NEW(action); |
temp = NEW(action); |
|
|
find_final_state(void) |
find_final_state(void) |
{ |
{ |
int goal, i; |
int goal, i; |
short *to_state; |
short *tto_state; |
shifts *p; |
shifts *p; |
|
|
p = shift_table[0]; |
p = shift_table[0]; |
to_state = p->shift; |
tto_state = p->shift; |
goal = ritem[1]; |
goal = ritem[1]; |
for (i = p->nshifts - 1; i >= 0; --i) { |
for (i = p->nshifts - 1; i >= 0; --i) { |
final_state = to_state[i]; |
final_state = tto_state[i]; |
if (accessing_symbol[final_state] == goal) |
if (accessing_symbol[final_state] == goal) |
break; |
break; |
} |
} |