README 该源码仅供参考,严禁直接抄袭! 源码如下 // // main.cpp // LexicalAnalyzer // // Created by 胡昱 on 2020/1/1. // Copyright © 2020年 胡昱. All rights reserved. // # include <iostream> # include <fstream> # include <vector> # include <string> using namespace std ; /*****************全局变量*****************/ /*****************关键字表*****************/ const static string reserveWords [ ] = { "main" , "if" , "else" , "while" , "do" , "for" , "int" , "double" , "float" , "char" , "long" , "short" , "enum" , "static" , "bool" , "void" , "switch" , "case" , "break" , "continue" , "signed" , "unsigned" , "return" , "defalut"