• 大小: 1KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-01-08
  • 语言: 其他
  • 标签:

资源简介

递归下降语法分析器(C版)

资源截图

代码片段和文件信息

/* 4.6 递归下降分析法 */
#include 
#include 
#include 
#define INPUT_AND_DISPLAY();     /* 读一个单词的二元式并输出单词种别 */ \
                                fscanf(fileInput“%c “&t.code);\
                                fscanf(fileInput“%s “t.val); \
                                fputc(t.codefileOutput);
void E(void);
void E1(void);
void T(void);
void T1(void);
void F(void);/* 函数原型 */
struct code_val{char code;char val[20];} t; /* 定义临时结构变量,存放单词二元式。 */
FILE *fileInput*fileOutput;
int main(int argcchar *argv[])
{
    if(argc==1) /*参数个数为1,即46.exe,没输入文件名,例如fin.txt*/
    {
     printf(“Have not enter file name.Press any key to exit...“);
     getch();
     exit(0);
    }
    if((fileInput=fopen(argv[1]“rt“))==NULL)
    {      /*“rt“只读打开一个文本文件,只允许读数据*

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2910  2007-04-24 13:25  RecursiveDropAnalysis.c

     文件         93  2007-04-24 12:51  fin.txt

     文件         20  2007-04-24 13:25  FOUT.TXT

----------- ---------  ---------- -----  ----

                 3023                    3


评论

共有 条评论