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

📄 maincpp.cpp

📁 能够实现词法分析,是我在学编译时做的,希望多提意见
💻 CPP
字号:
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <string.h>
#include <ctype.h>
#include "getsym.h"
#include "b.h"

FILE *fp=fopen("D:\\b.txt","rb+");
FILE *err=fopen("D:\\error.txt","rb+");

REWord REWords[20]={{"CONST","CONSTSYM"},{"if","ifSYM"},{"then","thenSYM"},{"begin","beginSYM"},{"end","endSYM"},
	{"call","callSYM"},{"read","readSYM"},{"write","writeSYM"},{"procedure","procedureSYM"},{"var","varSYM"}};

int lineNnm;

char *SYM;
char *ID;
double NUM;

void initComp();
void endComp();

int main(void)
{
	initComp();

	int i;
	do 
	{
		i=getSYM();
	} while (i>=0);
	
	endComp();

	return 0;
}

void initComp()
{
	lineNnm=1;
	cout<<"begin------------------>>"<<endl;
}

void endComp()
{
	fclose(fp);
	fclose(err);
	cout<<"end------------------->>"<<endl;
}

⌨️ 快捷键说明

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