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

📄 main.c

📁 参照清华大学《编译原理》写的cmm语言语法分析程序
💻 C
字号:
/**  * @file main.c * @brief  主程序 * @author Shiquan Ye, yeshiquan@gmail.com * @date 2008-11-12 *//* * Copyright (C) 2008 - Shiquan Ye, yeshiquan@gmail.com * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. */#include "globals.h"#include "scan.h"#include "parse.h"#include "analyze.h"#include "cgen.h"/* allocate global variables */ int lineno = 0; /* 行号 */ FILE * source;FILE * listing;FILE * code;int Error = FALSE;int main(int argc, char * argv[]) {      TreeNode * syntaxTree;      char pgm[120];    /* 源文件名 */      if (argc != 2) {            fprintf(stderr,"usage: %s <filename>\n",argv[0]);            exit(1);      }      strcpy(pgm,argv[1]);      if (strchr(pgm,'.') == NULL) strcat(pgm,".cmm");      if ( (source = fopen(pgm,"r")) == NULL) {            fprintf(stderr,"File %s not found\n",pgm);            exit(1);      }      listing = stdout; /* 向终端输出 */      int i = 0;      TreeNode * t = parse();      return 1;}

⌨️ 快捷键说明

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