⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ll.h

📁 编译原理课程设计
💻 H
字号:
#include "stdio.h"
#define SIZE 20
#define EMPTY 14
#define TABLE_SIZE 5

typedef struct table
...{
        char head;
        char  pre[8][4]; 
}table;

char ExpressionStr[SIZE];                       //Inputed Analysed Expression
char AnalysisStack[SIZE];                       //Analysis Stack
unsigned char analysis_Index;                   //
unsigned char analy_Index;                      //Current TOP_Index of Expression
unsigned char exp_Index;                        //Current Bottom_Index of Expression
unsigned char step;
table tb[TABLE_SIZE];                                               //forcast table---------------



/** *//***************************************
 @name:       InitTable
 @Describe:   Initlize the forcast table
 @Param:      void
 @Return:     void
 *****************************************/
void InitTable()
...{
     // table E
     tb[0].head = 'E';
     strcpy(tb[0].pre[0], "GT");
     strcpy(tb[0].pre[5], "GT");
     //table G
     tb[1].head = 'G';
     strcpy(tb[1].pre[1], "GT+");
     strcpy(tb[1].pre[2], "GT-");
     strcpy(tb[1].pre[6], "~");
     strcpy(tb[1].pre[7], "~");
     //table T
     tb[2].head = 'T';
     strcpy(tb[2].pre[0], "SF");
     strcpy(tb[2].pre[5], "SF");
     //table S
     tb[3].head = 'S';
     strcpy(tb[3].pre[1], "~");
     strcpy(tb[3].pre[2], "~");
     strcpy(tb[3].pre[3], "SF*");
     strcpy(tb[3].pre[4], "SF/");
     strcpy(tb[3].pre[6], "~");
     strcpy(tb[3].pre[7], "~");
     //table F
     tb[4].head = 'F';
     strcpy(tb[4].pre[0], "i");
     strcpy(tb[4].pre[5], ")E(");
}

/** *//***************************************
 @name:       PrintGenerate
 @Describe:   Printing Generate expression
 @Param:      void
 @Return:     void
 *****************************************/
 void PrintGenerate(char *ch)
 ...{
      int i = 0;
      for(i = strlen(ch) - 1; i >= 0; i--)
      ...{
            printf("%c",ch[i]);
      }
      printf(" ");
      
 }

/** *//*******************************************
*@name:        Trace
*@Description: Format output
*@Param:       void
*@Return:      void
********************************************/
void Trace()
...{
     int i = 0;
     int j = 0;
     printf(" ");
     printf("%d  ",step++);
     while(AnalysisStack[i] != '

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -