部分代码如下:需要的可联系我:QQ627845967
#include"iostream.h"
#include "stdio.h"
#include "malloc.h"
#include "conio.h"
struct Lchar{
char char_ch;
struct Lchar *next;
}Lchar,*p,*h,*temp,*top,*base;
char curchar;
char curtocmp;
int right;
int table[5][8]={{1,0,0,1,0,0},
{0,1,0,0,1,1},
{1,0,0,1,0,0},
{0,1,1,0,1,1},
{1,0,0,1,0,0}};
int i,j;
 
void push(char pchar)
{
temp=(struct Lchar*)malloc(sizeof(Lchar));
temp->char_ch=pchar;
temp->next=top;
top=temp;
}
 
void pop(void)
{
curtocmp=top->char_ch;
if(top->char_ch!='#')
top=top->next;
}
 
void doforpush(int t)
{
switch(t)
{
case 0:push('A');push('T');break;
case 5:push('A');push('T');break;
case 11:push('A');push('T');push('+');break;
 
case 20:push('B');push('F');break;
case 23:push('B');push('F');break;
case 32:push('B');push('F');push('*');break;
 
case 40:push('i');break;
case 43:push(')');push('E');push('(');
}
}
 
void changchartoint()
{
switch(curtocmp)
{
case 'A':i=1;break;
case 'B':i=3;break;
case 'E':i=0;break;
case 'T':i=2;break;
case 'F':i=4;
}
switch(curchar)
{
case 'i':j=0;break;
case '+':j=1;break;
 
case '*':j=2;break;
 
case '(':j=3;break;
case ')':j=4;break;
case '#':j=5;
}
}
                                    
                                    
                                         2024-04-28 21:47:59 
                                             245KB 
                                                LR(1)
                                     
                                        
                                            1