归档
所属分类:编译器/解释器
开发工具:C/C++
文件大小:4KB
下载次数:0
上传日期:2020-10-28 08:42:36
上 传 者:
Brian111
说明: c-minus的手动词法分析器,可输出行数并输出对应的二元组。
(C-minus's manual lexical analyzer can output the number of lines and the corresponding binary.)
文件列表:
man_lex.cpp (216, 2020-10-23)
test_cases (0, 2020-10-22)
test_cases\56_sort_test4.sy (789, 2020-08-22)
__MACOSX (0, 2020-10-28)
__MACOSX\test_cases (0, 2020-10-28)
__MACOSX\test_cases\._56_sort_test4.sy (228, 2020-08-22)
__MACOSX\._test_cases (172, 2020-10-22)
scanner.cpp (6619, 2020-10-23)
#词法分析器(cpp)
##scanner.cpp
####1.private:
```c++
bool isLetter(const char ch);
bool isNum(const char ch);
bool isKeyword(const string str);
bool isDelimiter(const char ch);
string txt_read(const string filePath);
```
text_read函数调用fread()函数使得读存数据效率大大提高
####2.public:
```void LA(string filePath);唯一对外可用方法```
##man_lex.cpp
1. 用户键入文件路径
2. 新建对象lexicalAnalysis
3. 调用LA函数
##测试用法:
```
g++ man_lex.cpp -std=c++11
./a.out
test_case_01.txt //同一目录下
```
近期下载者:
相关文件:
收藏者: