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

📄 main.cpp

📁 c语言编写
💻 CPP
字号:

#include"globals.h"
#include"stdio.h"
#define NO_PARSE FALSE
#define NO_ANALYZE TRUE
#define NO_CODE TRUE

#include"util.h"
#include"scan.h"
#include"parser.h"
#if !NO_ANALYZE
#include"analyze.h"
#endif

FILE* source;
FILE* listing;
FILE* code;
int  EchoSource = 1;
int TraceScan=TRUE;
int TraceParse=TRUE;
int TraceAnalyze=TRUE;
int TraceCode=TRUE;
int Error=FALSE;

void main(int argc, char* argv[])
{
	char pgm[70];
	if(argc!=2)
	{
		fprintf(stderr,"usage: %s <filename>\n",argv[0]);
		exit(1);
	}

	strcpy(pgm,argv[1]);
//	strcpy(pgm,"C:\\aa.c");
	if(strchr(pgm,'.')==NULL)
		strcat(pgm,".c");
	source=fopen(pgm,"r");
	if(source==NULL)
	{
		fprintf(stderr,"File %s not found\n",pgm);
		exit(1);
	}
	listing=fopen("c:\\lex.txt","w");
	if(listing==NULL)
	{
		fprintf(stderr,"File c:\\lex.txt not found\n");
		exit(1);
	}
	fprintf(listing,"\nc- COMPILATION: %s\n",pgm);
//	while (getToken()!=ENDFILE);
//	reposition(source);//文件复位
//	rewind(source);
	Parser ParserObj;
	ParserObj.Parsing();
	ParserObj.PrintTree(listing);
	fclose(source);
	fclose(listing);
	return ;
}

⌨️ 快捷键说明

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