본문내용
(q, p)||(stack_top == -1)));
for(i=0; i<=stack_top; i++) {
qi = stack[i];
if(i==0) printf("%s\n", qi.sentential_form);
else printf(" => %10s (%d)\n", qi.sentential_form, backup);
backup = qi.rule_no;
}
if(stack_top>=0) printf(" => %10s\n", p);
}
void push(stack_element initial)
{
stack_top++;
stack[stack_top] = initial;
}
stack_element pop()
{
if (stack_top>=0) {
return stack[stack_top--];
}
else {
printf("stack empty!!");
exit(1);
}
}
int find_rule_no(char nonterminal, int i) {
int temp_a, temp_b;
for(int k=i; k<5; k++) {
temp_a = ruletable[k].LHS;
temp_b = nonterminal;
if (temp_a==temp_b) return k+1;
}
return -1;
}
int is_terminal_string(char *q)
{
int i, temp;
for(i=0; i
temp = q[i];
if(temp==num_s||temp==num_t||temp==num_a) return 0;
}
if(i==strlen(q)) return 1;
}
for(i=0; i<=stack_top; i++) {
qi = stack[i];
if(i==0) printf("%s\n", qi.sentential_form);
else printf(" => %10s (%d)\n", qi.sentential_form, backup);
backup = qi.rule_no;
}
if(stack_top>=0) printf(" => %10s\n", p);
}
void push(stack_element initial)
{
stack_top++;
stack[stack_top] = initial;
}
stack_element pop()
{
if (stack_top>=0) {
return stack[stack_top--];
}
else {
printf("stack empty!!");
exit(1);
}
}
int find_rule_no(char nonterminal, int i) {
int temp_a, temp_b;
for(int k=i; k<5; k++) {
temp_a = ruletable[k].LHS;
temp_b = nonterminal;
if (temp_a==temp_b) return k+1;
}
return -1;
}
int is_terminal_string(char *q)
{
int i, temp;
for(i=0; i
if(temp==num_s||temp==num_t||temp==num_a) return 0;
}
if(i==strlen(q)) return 1;
}
소개글