pascal.cpp

来自「词法分析程序」· C++ 代码 · 共 36 行

CPP
36
字号
#include "stdafx.h"#include "common.h"#include "lex.h"#include "string.h"
#include <iostream.h>

int main(int argc, char* argv[])
{	if(argc>1)
	{		strcpy(sourcefile,argv[1]);		register char* cp;		cp=&sourcefile[strlen(sourcefile)]-1;		yyin=fopen(sourcefile,"r");		while((cp>=sourcefile)&&(*cp!='.')&&(*cp!='\\'))cp--;		if(*cp=='.')*cp=0;	}
#ifdef _DEBUG	else{		strcpy(sourcefile,"example");		yyin=fopen("example.pas","r");	}#endif	if(yyin==NULL){		cout<<"请在屏幕输入源文件,按ctrl+z结束输入"<<endl;		yyin=0;	}	yyout=fopen("out.txt","w");	while(lex()!=0);//print_result(yyout);	fclose(yyout);	if(yyin!=NULL)fclose(yyin);	return 0;}

⌨️ 快捷键说明

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