├── README.md
├── code
├── Regex2Lex
│ ├── .qmake.stash
│ ├── Regex2Lex.pro
│ ├── Regex2Lex.pro.user
│ ├── Regex2Lex.sln
│ ├── Regex2Lex.vcxproj
│ ├── Regex2Lex.vcxproj.filters
│ ├── Regex2Lex.vcxproj.user
│ ├── main.cpp
│ ├── readme.txt
│ ├── ui_widget.h
│ ├── widget.cpp
│ ├── widget.h
│ └── widget.ui
├── SLR1Processer
│ ├── .qmake.stash
│ ├── SLR1Processer.pro
│ ├── SLR1Processer.pro.user
│ ├── SLR1Processer.sln
│ ├── SLR1Processer.vcxproj
│ ├── SLR1Processer.vcxproj.filters
│ ├── SLR1Processer.vcxproj.user
│ ├── main.cpp
│ ├── readme.txt
│ ├── ui_widget.h
│ ├── widget.cpp
│ ├── widget.h
│ └── widget.ui
└── 编译说明.txt
├── docs
├── 报告设计书-pdf版本.pdf
└── 报告设计书-word版本.doc
├── test
├── 1. 任务一测试文本及程序
│ ├── 1. 测试文本
│ │ ├── tiny正则表达式.txt
│ │ └── tiny示例程序.tny
│ └── 2. 程序生成文件
│ │ ├── _lexer.c
│ │ ├── _lexer.exe
│ │ ├── _sample.tny
│ │ └── output.lex
├── 2. 任务二测试文本及程序
│ ├── 1. 测试文本
│ │ ├── tiny文法.txt
│ │ └── 语义函数.txt
│ └── 2. 程序生成文件
│ │ ├── SLR1Str.txt
│ │ ├── output.lex
│ │ ├── tree.out
│ │ └── treeCode.cpp
├── 3. 任务三测试文本及程序
│ ├── 项目任务1
│ │ ├── 1. 测试文本
│ │ │ ├── minic正则表达式.txt
│ │ │ └── 示例程序.txt
│ │ └── 2. 程序生成文件
│ │ │ ├── _lexer.c
│ │ │ ├── _lexer.exe
│ │ │ ├── _sample.tny
│ │ │ └── output.lex
│ └── 项目任务2
│ │ ├── 1. 测试文本
│ │ ├── 文法.txt
│ │ └── 语义函数.txt
│ │ └── 2. 测试生成的程序
│ │ ├── SLR1Str.txt
│ │ ├── output.lex
│ │ ├── tree.out
│ │ └── treeCode.cpp
└── 4. 测试报告
│ ├── pdf版本
│ ├── 项目任务1:项目测试报告.pdf
│ ├── 项目任务2:项目测试报告.pdf
│ └── 项目任务3:项目测试报告.pdf
│ └── word版本
│ ├── ~$任务3:项目测试报告.docx
│ ├── 项目任务1:项目测试报告.docx
│ ├── 项目任务2:项目测试报告.docx
│ └── 项目任务3:项目测试报告.docx
├── 编译原理课程项目-讲稿.pdf
└── 编译原理课程项目任务书.pdf
/README.md:
--------------------------------------------------------------------------------
1 | # Compiler-Principles-Project
2 | 华南师范大学 2021级(2023-2024下学期) 编译原理项目
3 |
4 | 1. 请先阅读任务书,确保任务一致
5 | 2. 仅完成任务书中必做部分,该项目能拿到70-80分
6 |
--------------------------------------------------------------------------------
/code/Regex2Lex/.qmake.stash:
--------------------------------------------------------------------------------
1 | QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
2 | QMAKE_CXX.QMAKE_MSC_VER = 1932
3 | QMAKE_CXX.QMAKE_MSC_FULL_VER = 193231329
4 | QMAKE_CXX.COMPILER_MACROS = \
5 | QT_COMPILER_STDCXX \
6 | QMAKE_MSC_VER \
7 | QMAKE_MSC_FULL_VER
8 | QMAKE_CXX.INCDIRS = \
9 | "D:\\Program Files (x86)\\VS PRO\\VC\\Tools\\MSVC\\14.32.31326\\ATLMFC\\include" \
10 | "D:\\Program Files (x86)\\VS PRO\\VC\\Tools\\MSVC\\14.32.31326\\include" \
11 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" \
12 | "D:\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt" \
13 | "D:\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\shared" \
14 | "D:\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\um" \
15 | "D:\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\winrt" \
16 | "D:\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\cppwinrt"
17 | QMAKE_CXX.LIBDIRS = \
18 | "D:\\Program Files (x86)\\VS PRO\\VC\\Tools\\MSVC\\14.32.31326\\ATLMFC\\lib\\x64" \
19 | "D:\\Program Files (x86)\\VS PRO\\VC\\Tools\\MSVC\\14.32.31326\\lib\\x64" \
20 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x64" \
21 | "D:\\Windows Kits\\10\\lib\\10.0.19041.0\\ucrt\\x64" \
22 | "D:\\Windows Kits\\10\\\\lib\\10.0.19041.0\\\\um\\x64"
23 |
--------------------------------------------------------------------------------
/code/Regex2Lex/Regex2Lex.pro:
--------------------------------------------------------------------------------
1 | QT += core gui
2 |
3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
4 |
5 | CONFIG += c++11
6 |
7 | # You can make your code fail to compile if it uses deprecated APIs.
8 | # In order to do so, uncomment the following line.
9 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10 |
11 | SOURCES += \
12 | main.cpp \
13 | widget.cpp
14 |
15 | HEADERS += \
16 | widget.h
17 |
18 | FORMS += \
19 | widget.ui
20 |
21 | # Default rules for deployment.
22 | qnx: target.path = /tmp/$${TARGET}/bin
23 | else: unix:!android: target.path = /opt/$${TARGET}/bin
24 | !isEmpty(target.path): INSTALLS += target
25 |
--------------------------------------------------------------------------------
/code/Regex2Lex/Regex2Lex.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {edf33a81-1efa-46b4-87bb-6e8eaf4d1312}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | false
41 | true
42 | false
43 | 0
44 | true
45 | true
46 | 0
47 | 8
48 | true
49 | false
50 | 0
51 | true
52 | true
53 | true
54 | *.md, *.MD, Makefile
55 | false
56 | true
57 |
58 |
59 |
60 | ProjectExplorer.Project.PluginSettings
61 |
62 |
63 | true
64 | false
65 | true
66 | true
67 | true
68 | true
69 |
70 |
71 | 0
72 | true
73 |
74 | -fno-delayed-template-parsing
75 |
76 | true
77 | Builtin.BuildSystem
78 |
79 | true
80 | true
81 | Builtin.DefaultTidyAndClazy
82 | 8
83 |
84 |
85 |
86 | true
87 |
88 |
89 |
90 |
91 | ProjectExplorer.Project.Target.0
92 |
93 | Desktop
94 | Desktop Qt 5.12.12 MinGW 64-bit
95 | Desktop Qt 5.12.12 MinGW 64-bit
96 | qt.qt5.51212.win64_mingw73_kit
97 | 0
98 | 0
99 | 0
100 |
101 | 0
102 | F:\Code\QTproject\build-Regex2Lex-Desktop_Qt_5_12_12_MinGW_64_bit-Debug
103 | F:/Code/QTproject/build-Regex2Lex-Desktop_Qt_5_12_12_MinGW_64_bit-Debug
104 |
105 |
106 | true
107 | QtProjectManager.QMakeBuildStep
108 | false
109 |
110 |
111 |
112 | true
113 | Qt4ProjectManager.MakeStep
114 |
115 | 2
116 | Build
117 | Build
118 | ProjectExplorer.BuildSteps.Build
119 |
120 |
121 |
122 | true
123 | Qt4ProjectManager.MakeStep
124 | clean
125 |
126 | 1
127 | Clean
128 | Clean
129 | ProjectExplorer.BuildSteps.Clean
130 |
131 | 2
132 | false
133 |
134 |
135 | Debug
136 | Qt4ProjectManager.Qt4BuildConfiguration
137 | 2
138 |
139 |
140 | F:\Code\QTproject\build-Regex2Lex-Desktop_Qt_5_12_12_MinGW_64_bit-Release
141 | F:/Code/QTproject/build-Regex2Lex-Desktop_Qt_5_12_12_MinGW_64_bit-Release
142 |
143 |
144 | true
145 | QtProjectManager.QMakeBuildStep
146 | false
147 |
148 |
149 |
150 | true
151 | Qt4ProjectManager.MakeStep
152 |
153 | 2
154 | Build
155 | Build
156 | ProjectExplorer.BuildSteps.Build
157 |
158 |
159 |
160 | true
161 | Qt4ProjectManager.MakeStep
162 | clean
163 |
164 | 1
165 | Clean
166 | Clean
167 | ProjectExplorer.BuildSteps.Clean
168 |
169 | 2
170 | false
171 |
172 |
173 | Release
174 | Qt4ProjectManager.Qt4BuildConfiguration
175 | 0
176 | 0
177 |
178 |
179 | 0
180 | F:\Code\QTproject\build-Regex2Lex-Desktop_Qt_5_12_12_MinGW_64_bit-Profile
181 | F:/Code/QTproject/build-Regex2Lex-Desktop_Qt_5_12_12_MinGW_64_bit-Profile
182 |
183 |
184 | true
185 | QtProjectManager.QMakeBuildStep
186 | false
187 |
188 |
189 |
190 | true
191 | Qt4ProjectManager.MakeStep
192 |
193 | 2
194 | Build
195 | Build
196 | ProjectExplorer.BuildSteps.Build
197 |
198 |
199 |
200 | true
201 | Qt4ProjectManager.MakeStep
202 | clean
203 |
204 | 1
205 | Clean
206 | Clean
207 | ProjectExplorer.BuildSteps.Clean
208 |
209 | 2
210 | false
211 |
212 |
213 | Profile
214 | Qt4ProjectManager.Qt4BuildConfiguration
215 | 0
216 | 0
217 | 0
218 |
219 | 3
220 |
221 |
222 | 0
223 | Deploy
224 | Deploy
225 | ProjectExplorer.BuildSteps.Deploy
226 |
227 | 1
228 |
229 | false
230 | ProjectExplorer.DefaultDeployConfiguration
231 |
232 | 1
233 |
234 | true
235 | true
236 | true
237 |
238 | 2
239 |
240 | Qt4ProjectManager.Qt4RunConfiguration:F:/Code/QTproject/Regex2Lex/Regex2Lex.pro
241 | F:/Code/QTproject/Regex2Lex/Regex2Lex.pro
242 | false
243 | true
244 | true
245 | false
246 | true
247 | F:/Code/QTproject/build-Regex2Lex-Desktop_Qt_5_12_12_MinGW_64_bit-Debug
248 |
249 | 1
250 |
251 |
252 |
253 | ProjectExplorer.Project.TargetCount
254 | 1
255 |
256 |
257 | ProjectExplorer.Project.Updater.FileVersion
258 | 22
259 |
260 |
261 | Version
262 | 22
263 |
264 |
265 |
--------------------------------------------------------------------------------
/code/Regex2Lex/Regex2Lex.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32526.322
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Regex2Lex", "Regex2Lex.vcxproj", "{805611EE-3DA1-34B2-B0C8-336C7F5E8960}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {805611EE-3DA1-34B2-B0C8-336C7F5E8960}.Debug|x64.ActiveCfg = Debug|x64
15 | {805611EE-3DA1-34B2-B0C8-336C7F5E8960}.Debug|x64.Build.0 = Debug|x64
16 | {805611EE-3DA1-34B2-B0C8-336C7F5E8960}.Release|x64.ActiveCfg = Release|x64
17 | {805611EE-3DA1-34B2-B0C8-336C7F5E8960}.Release|x64.Build.0 = Release|x64
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {EB1E5020-EBB3-4D81-955F-8DED8D54C520}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/code/Regex2Lex/Regex2Lex.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Release
6 | x64
7 |
8 |
9 | Debug
10 | x64
11 |
12 |
13 |
14 | {805611EE-3DA1-34B2-B0C8-336C7F5E8960}
15 | Regex2Lex
16 | QtVS_v304
17 | 10.0.19041.0
18 | 10.0.19041.0
19 | $(MSBuildProjectDirectory)\QtMsBuild
20 |
21 |
22 | v142
23 | release\
24 | false
25 | NotSet
26 | Application
27 | release\
28 | Regex2Lex
29 |
30 |
31 | v142
32 | debug\
33 | false
34 | NotSet
35 | Application
36 | debug\
37 | Regex2Lex
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | debug\debug\Regex2Lextruerelease\release\Regex2Lextruefalse5.12.12_msvc2017_64core;gui;widgets5.12.12_msvc2017_64core;gui;widgets
48 |
49 |
50 |
51 | GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;release;/include;%(AdditionalIncludeDirectories)
52 | -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)
53 | release\
54 | false
55 | None
56 | 4577;4467;%(DisableSpecificWarnings)
57 | Sync
58 | release\
59 | MaxSpeed
60 | _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions)
61 | false
62 |
63 | MultiThreadedDLL
64 | true
65 | true
66 | Level3
67 | true
68 |
69 | shell32.lib;%(AdditionalDependencies)
70 | C:\openssl\lib;C:\Utils\my_sql\mysql-5.6.11-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories)
71 | "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)
72 | true
73 | false
74 | true
75 | false
76 | $(OutDir)\Regex2Lex.exe
77 | true
78 | Windows
79 | true
80 |
81 |
82 | Unsigned
83 | None
84 | 0
85 |
86 |
87 | _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;%(PreprocessorDefinitions)
88 |
89 | msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h
90 |
91 |
92 | GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;debug;/include;%(AdditionalIncludeDirectories)
93 | -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)
94 | debug\
95 | false
96 | ProgramDatabase
97 | 4577;4467;%(DisableSpecificWarnings)
98 | Sync
99 | debug\
100 | Disabled
101 | _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;%(PreprocessorDefinitions)
102 | false
103 | MultiThreadedDebugDLL
104 | true
105 | true
106 | Level3
107 | true
108 |
109 | shell32.lib;%(AdditionalDependencies)
110 | C:\openssl\lib;C:\Utils\my_sql\mysql-5.6.11-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories)
111 | "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)
112 | true
113 | true
114 | true
115 | $(OutDir)\Regex2Lex.exe
116 | true
117 | Windows
118 | true
119 |
120 |
121 | Unsigned
122 | None
123 | 0
124 |
125 |
126 | _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;_DEBUG;%(PreprocessorDefinitions)
127 |
128 | msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 | Document
148 | true
149 | $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)
150 | cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h
151 | Generate moc_predefs.h
152 | debug\moc_predefs.h;%(Outputs)
153 |
154 |
155 | Document
156 | $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)
157 | cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h
158 | Generate moc_predefs.h
159 | release\moc_predefs.h;%(Outputs)
160 | true
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
--------------------------------------------------------------------------------
/code/Regex2Lex/Regex2Lex.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
6 | ui
7 | false
8 |
9 |
10 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
11 | ui
12 | false
13 |
14 |
15 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
16 | cpp;c;cxx;moc;h;def;odl;idl;res;
17 |
18 |
19 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
20 | cpp;c;cxx;moc;h;def;odl;idl;res;
21 |
22 |
23 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
24 | h;hpp;hxx;hm;inl;inc;xsd
25 |
26 |
27 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
28 | h;hpp;hxx;hm;inl;inc;xsd
29 |
30 |
31 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
32 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
33 |
34 |
35 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
36 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
37 |
38 |
39 |
40 |
41 | Source Files
42 |
43 |
44 | Source Files
45 |
46 |
47 |
48 |
49 | Header Files
50 |
51 |
52 |
53 |
54 | Generated Files
55 |
56 |
57 | Generated Files
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | Form Files
66 |
67 |
68 |
--------------------------------------------------------------------------------
/code/Regex2Lex/Regex2Lex.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 2024-05-03T08:19:51.6388696Z
6 |
7 |
8 | 2024-05-03T08:19:51.7208872Z
9 |
10 |
--------------------------------------------------------------------------------
/code/Regex2Lex/main.cpp:
--------------------------------------------------------------------------------
1 | #include "widget.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | Widget w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/code/Regex2Lex/readme.txt:
--------------------------------------------------------------------------------
1 | 1. main.cpp 主程序入口
2 | 2. ui_widget.h 和 widget.h 为 头文件
3 | 3. widget.ui 为操作界面UI文件
4 | 4. widget.cpp 是核心代码程序
5 | 5. Regex2Lex.pro 是 QT 程序入口
6 | 6. Regex2Lex.sln 是 VS2019 入口,当VS装入QT插件后,即可快速打开
7 | 7. 剩余文件为VS缓存文件,建议不要删除,可以快速打开。
--------------------------------------------------------------------------------
/code/Regex2Lex/ui_widget.h:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | ** Form generated from reading UI file 'widget.ui'
3 | **
4 | ** Created by: Qt User Interface Compiler version 5.12.12
5 | **
6 | ** WARNING! All changes made in this file will be lost when recompiling UI file!
7 | ********************************************************************************/
8 |
9 | #ifndef UI_WIDGET_H
10 | #define UI_WIDGET_H
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 |
24 | QT_BEGIN_NAMESPACE
25 |
26 | class Ui_Widget
27 | {
28 | public:
29 | QWidget *widget;
30 | QWidget *widget_2;
31 | QHBoxLayout *horizontalLayout;
32 | QSpacerItem *horizontalSpacer;
33 | QLabel *label;
34 | QSpacerItem *horizontalSpacer_2;
35 | QPlainTextEdit *plainTextEdit;
36 | QWidget *widget_3;
37 | QHBoxLayout *horizontalLayout_2;
38 | QSpacerItem *horizontalSpacer_3;
39 | QPushButton *pushButton;
40 | QSpacerItem *horizontalSpacer_4;
41 | QPushButton *pushButton_4;
42 | QSpacerItem *horizontalSpacer_9;
43 | QPushButton *pushButton_3;
44 | QSpacerItem *horizontalSpacer_8;
45 | QPushButton *pushButton_5;
46 | QSpacerItem *horizontalSpacer_10;
47 | QPushButton *pushButton_2;
48 | QSpacerItem *horizontalSpacer_11;
49 | QPushButton *pushButton_8;
50 | QSpacerItem *horizontalSpacer_5;
51 | QWidget *widget_4;
52 | QHBoxLayout *horizontalLayout_3;
53 | QSpacerItem *horizontalSpacer_6;
54 | QLabel *label_2;
55 | QSpacerItem *horizontalSpacer_7;
56 | QLabel *label_3;
57 | QLabel *label_4;
58 | QTableWidget *tableWidget;
59 | QPushButton *pushButton_6;
60 | QPushButton *pushButton_7;
61 | QPlainTextEdit *plainTextEdit_2;
62 | QPushButton *pushButton_9;
63 | QCheckBox *checkBox;
64 |
65 | void setupUi(QWidget *Widget)
66 | {
67 | if (Widget->objectName().isEmpty())
68 | Widget->setObjectName(QString::fromUtf8("Widget"));
69 | Widget->resize(936, 699);
70 | widget = new QWidget(Widget);
71 | widget->setObjectName(QString::fromUtf8("widget"));
72 | widget->setGeometry(QRect(10, 10, 910, 661));
73 | QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
74 | sizePolicy.setHorizontalStretch(0);
75 | sizePolicy.setVerticalStretch(0);
76 | sizePolicy.setHeightForWidth(widget->sizePolicy().hasHeightForWidth());
77 | widget->setSizePolicy(sizePolicy);
78 | widget_2 = new QWidget(widget);
79 | widget_2->setObjectName(QString::fromUtf8("widget_2"));
80 | widget_2->setGeometry(QRect(0, 0, 911, 71));
81 | horizontalLayout = new QHBoxLayout(widget_2);
82 | horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
83 | horizontalSpacer = new QSpacerItem(226, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
84 |
85 | horizontalLayout->addItem(horizontalSpacer);
86 |
87 | label = new QLabel(widget_2);
88 | label->setObjectName(QString::fromUtf8("label"));
89 | QFont font;
90 | font.setFamily(QString::fromUtf8("\345\276\256\350\275\257\351\233\205\351\273\221"));
91 | font.setPointSize(23);
92 | font.setBold(true);
93 | font.setWeight(75);
94 | label->setFont(font);
95 |
96 | horizontalLayout->addWidget(label);
97 |
98 | horizontalSpacer_2 = new QSpacerItem(225, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
99 |
100 | horizontalLayout->addItem(horizontalSpacer_2);
101 |
102 | plainTextEdit = new QPlainTextEdit(widget);
103 | plainTextEdit->setObjectName(QString::fromUtf8("plainTextEdit"));
104 | plainTextEdit->setGeometry(QRect(0, 300, 911, 361));
105 | plainTextEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
106 | plainTextEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
107 | plainTextEdit->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
108 | plainTextEdit->setReadOnly(true);
109 | widget_3 = new QWidget(widget);
110 | widget_3->setObjectName(QString::fromUtf8("widget_3"));
111 | widget_3->setGeometry(QRect(0, 240, 911, 61));
112 | horizontalLayout_2 = new QHBoxLayout(widget_3);
113 | horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
114 | horizontalSpacer_3 = new QSpacerItem(148, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
115 |
116 | horizontalLayout_2->addItem(horizontalSpacer_3);
117 |
118 | pushButton = new QPushButton(widget_3);
119 | pushButton->setObjectName(QString::fromUtf8("pushButton"));
120 | QFont font1;
121 | font1.setFamily(QString::fromUtf8("\345\276\256\350\275\257\351\233\205\351\273\221"));
122 | font1.setPointSize(15);
123 | pushButton->setFont(font1);
124 |
125 | horizontalLayout_2->addWidget(pushButton);
126 |
127 | horizontalSpacer_4 = new QSpacerItem(148, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
128 |
129 | horizontalLayout_2->addItem(horizontalSpacer_4);
130 |
131 | pushButton_4 = new QPushButton(widget_3);
132 | pushButton_4->setObjectName(QString::fromUtf8("pushButton_4"));
133 | pushButton_4->setFont(font1);
134 |
135 | horizontalLayout_2->addWidget(pushButton_4);
136 |
137 | horizontalSpacer_9 = new QSpacerItem(148, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
138 |
139 | horizontalLayout_2->addItem(horizontalSpacer_9);
140 |
141 | pushButton_3 = new QPushButton(widget_3);
142 | pushButton_3->setObjectName(QString::fromUtf8("pushButton_3"));
143 | pushButton_3->setFont(font1);
144 |
145 | horizontalLayout_2->addWidget(pushButton_3);
146 |
147 | horizontalSpacer_8 = new QSpacerItem(148, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
148 |
149 | horizontalLayout_2->addItem(horizontalSpacer_8);
150 |
151 | pushButton_5 = new QPushButton(widget_3);
152 | pushButton_5->setObjectName(QString::fromUtf8("pushButton_5"));
153 | pushButton_5->setFont(font1);
154 |
155 | horizontalLayout_2->addWidget(pushButton_5);
156 |
157 | horizontalSpacer_10 = new QSpacerItem(148, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
158 |
159 | horizontalLayout_2->addItem(horizontalSpacer_10);
160 |
161 | pushButton_2 = new QPushButton(widget_3);
162 | pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
163 | pushButton_2->setFont(font1);
164 |
165 | horizontalLayout_2->addWidget(pushButton_2);
166 |
167 | horizontalSpacer_11 = new QSpacerItem(148, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
168 |
169 | horizontalLayout_2->addItem(horizontalSpacer_11);
170 |
171 | pushButton_8 = new QPushButton(widget_3);
172 | pushButton_8->setObjectName(QString::fromUtf8("pushButton_8"));
173 | pushButton_8->setFont(font1);
174 |
175 | horizontalLayout_2->addWidget(pushButton_8);
176 |
177 | horizontalSpacer_5 = new QSpacerItem(148, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
178 |
179 | horizontalLayout_2->addItem(horizontalSpacer_5);
180 |
181 | widget_4 = new QWidget(widget);
182 | widget_4->setObjectName(QString::fromUtf8("widget_4"));
183 | widget_4->setGeometry(QRect(-1, 69, 911, 41));
184 | horizontalLayout_3 = new QHBoxLayout(widget_4);
185 | horizontalLayout_3->setObjectName(QString::fromUtf8("horizontalLayout_3"));
186 | horizontalSpacer_6 = new QSpacerItem(182, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
187 |
188 | horizontalLayout_3->addItem(horizontalSpacer_6);
189 |
190 | label_2 = new QLabel(widget_4);
191 | label_2->setObjectName(QString::fromUtf8("label_2"));
192 | QFont font2;
193 | font2.setPointSize(12);
194 | label_2->setFont(font2);
195 | label_2->setLayoutDirection(Qt::LeftToRight);
196 | label_2->setAlignment(Qt::AlignCenter);
197 |
198 | horizontalLayout_3->addWidget(label_2);
199 |
200 | horizontalSpacer_7 = new QSpacerItem(181, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
201 |
202 | horizontalLayout_3->addItem(horizontalSpacer_7);
203 |
204 | label_3 = new QLabel(widget);
205 | label_3->setObjectName(QString::fromUtf8("label_3"));
206 | label_3->setGeometry(QRect(0, 230, 911, 16));
207 | QFont font3;
208 | font3.setFamily(QString::fromUtf8("\345\276\256\350\275\257\351\233\205\351\273\221"));
209 | label_3->setFont(font3);
210 | label_4 = new QLabel(widget);
211 | label_4->setObjectName(QString::fromUtf8("label_4"));
212 | label_4->setGeometry(QRect(0, 110, 421, 16));
213 | label_4->setFont(font3);
214 | tableWidget = new QTableWidget(widget);
215 | tableWidget->setObjectName(QString::fromUtf8("tableWidget"));
216 | tableWidget->setGeometry(QRect(0, 300, 911, 361));
217 | tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
218 | tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
219 | tableWidget->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
220 | pushButton_6 = new QPushButton(widget);
221 | pushButton_6->setObjectName(QString::fromUtf8("pushButton_6"));
222 | pushButton_6->setGeometry(QRect(660, 190, 101, 28));
223 | QFont font4;
224 | font4.setFamily(QString::fromUtf8("\345\276\256\350\275\257\351\233\205\351\273\221"));
225 | font4.setPointSize(10);
226 | pushButton_6->setFont(font4);
227 | pushButton_7 = new QPushButton(widget);
228 | pushButton_7->setObjectName(QString::fromUtf8("pushButton_7"));
229 | pushButton_7->setGeometry(QRect(780, 190, 111, 28));
230 | pushButton_7->setFont(font4);
231 | plainTextEdit_2 = new QPlainTextEdit(widget);
232 | plainTextEdit_2->setObjectName(QString::fromUtf8("plainTextEdit_2"));
233 | plainTextEdit_2->setGeometry(QRect(0, 130, 651, 91));
234 | plainTextEdit_2->setFont(font4);
235 | pushButton_9 = new QPushButton(widget);
236 | pushButton_9->setObjectName(QString::fromUtf8("pushButton_9"));
237 | pushButton_9->setGeometry(QRect(660, 160, 231, 28));
238 | QFont font5;
239 | font5.setFamily(QString::fromUtf8("\345\276\256\350\275\257\351\233\205\351\273\221"));
240 | font5.setPointSize(12);
241 | pushButton_9->setFont(font5);
242 | checkBox = new QCheckBox(widget);
243 | checkBox->setObjectName(QString::fromUtf8("checkBox"));
244 | checkBox->setGeometry(QRect(660, 140, 221, 16));
245 | checkBox->setFont(font4);
246 | checkBox->setTristate(false);
247 |
248 | retranslateUi(Widget);
249 |
250 | QMetaObject::connectSlotsByName(Widget);
251 | } // setupUi
252 |
253 | void retranslateUi(QWidget *Widget)
254 | {
255 | Widget->setWindowTitle(QApplication::translate("Widget", "\351\241\271\347\233\2561 author\357\274\232\346\235\216\350\276\276\350\211\257", nullptr));
256 | label->setText(QApplication::translate("Widget", "\351\241\271\347\233\256\344\270\200\357\274\232\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217\350\275\254lex", nullptr));
257 | plainTextEdit->setDocumentTitle(QString());
258 | plainTextEdit->setPlaceholderText(QApplication::translate("Widget", "\346\255\244\345\244\204\345\260\206\344\274\232\346\230\276\347\244\272\347\273\223\346\236\234", nullptr));
259 | pushButton->setText(QApplication::translate("Widget", "\345\274\200\345\247\213\345\210\206\346\236\220", nullptr));
260 | pushButton_4->setText(QApplication::translate("Widget", "NFA", nullptr));
261 | pushButton_3->setText(QApplication::translate("Widget", "DFA", nullptr));
262 | pushButton_5->setText(QApplication::translate("Widget", "DFA\346\234\200\345\260\217\345\214\226", nullptr));
263 | pushButton_2->setText(QApplication::translate("Widget", "\350\257\215\346\263\225\345\210\206\346\236\220\347\250\213\345\272\217", nullptr));
264 | pushButton_8->setText(QApplication::translate("Widget", "\346\237\245\347\234\213lex\346\226\207\344\273\266", nullptr));
265 | label_2->setText(QApplication::translate("Widget", "\345\247\223\345\220\215\357\274\232\346\235\216\350\276\276\350\211\257 \347\217\255\347\272\247\357\274\232\350\256\241\347\247\2211\347\217\255 \345\255\246\345\217\267\357\274\23220203231004", nullptr));
266 | label_3->setText(QApplication::translate("Widget", "\345\212\237\350\203\275\351\200\211\346\213\251\357\274\232\350\276\223\345\205\245\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217\345\220\216\357\274\214\350\257\267\345\205\210\347\202\271\345\207\273\345\274\200\345\247\213\345\210\206\346\236\220\357\274\214\345\206\215\347\202\271\345\207\273\345\205\266\344\273\226\346\214\211\351\222\256\346\237\245\347\234\213\347\273\223\346\236\234\357\274\214\346\263\250\346\204\217\347\224\237\346\210\220\347\232\204NFA\345\222\214DFA\345\233\276\344\270\215\345\220\253\345\205\263\351\224\256\350\257\215\343\200\202", nullptr));
267 | label_4->setText(QApplication::translate("Widget", "\350\257\267\350\276\223\345\205\245\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217\357\274\214\345\205\267\344\275\223\350\276\223\345\205\245\350\247\204\345\210\231\350\257\267\347\202\271\345\207\273\345\217\263\350\276\271\342\200\234\346\237\245\347\234\213\350\247\204\345\210\231\342\200\235\346\214\211\351\222\256", nullptr));
268 | pushButton_6->setText(QApplication::translate("Widget", "\344\270\212\344\274\240\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217", nullptr));
269 | pushButton_7->setText(QApplication::translate("Widget", "\344\270\213\350\275\275\346\255\243\345\210\231\350\241\250\350\276\276\345\274\217", nullptr));
270 | #ifndef QT_NO_TOOLTIP
271 | plainTextEdit_2->setToolTip(QApplication::translate("Widget", "
", nullptr));
272 | #endif // QT_NO_TOOLTIP
273 | plainTextEdit_2->setPlainText(QString());
274 | plainTextEdit_2->setPlaceholderText(QString());
275 | pushButton_9->setText(QApplication::translate("Widget", "\346\237\245\347\234\213\350\247\204\345\210\231", nullptr));
276 | checkBox->setText(QApplication::translate("Widget", "\350\213\245\350\257\215\346\263\225\345\210\206\346\236\220\345\277\275\347\225\245\345\244\247\345\260\217\345\206\231\357\274\214\350\257\267\345\213\276\351\200\211", nullptr));
277 | } // retranslateUi
278 |
279 | };
280 |
281 | namespace Ui {
282 | class Widget: public Ui_Widget {};
283 | } // namespace Ui
284 |
285 | QT_END_NAMESPACE
286 |
287 | #endif // UI_WIDGET_H
288 |
--------------------------------------------------------------------------------
/code/Regex2Lex/widget.h:
--------------------------------------------------------------------------------
1 | #ifndef WIDGET_H
2 | #define WIDGET_H
3 |
4 | #include
5 |
6 | QT_BEGIN_NAMESPACE
7 | namespace Ui { class Widget; }
8 | QT_END_NAMESPACE
9 |
10 | class Widget : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | Widget(QWidget *parent = nullptr);
16 | ~Widget();
17 |
18 |
19 | private slots:
20 | void on_pushButton_clicked();
21 |
22 | void on_pushButton_4_clicked();
23 |
24 | void on_pushButton_3_clicked();
25 |
26 | void on_pushButton_5_clicked();
27 |
28 | void on_pushButton_8_clicked();
29 |
30 | void on_pushButton_6_clicked();
31 |
32 | void on_pushButton_7_clicked();
33 |
34 | void on_pushButton_9_clicked();
35 |
36 | void on_pushButton_2_clicked();
37 |
38 | private:
39 | Ui::Widget *ui;
40 | };
41 | #endif // WIDGET_H
42 |
--------------------------------------------------------------------------------
/code/Regex2Lex/widget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Widget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 936
10 | 699
11 |
12 |
13 |
14 | 项目1 author:李达良
15 |
16 |
17 |
18 |
19 | 10
20 | 10
21 | 910
22 | 661
23 |
24 |
25 |
26 |
27 | 0
28 | 0
29 |
30 |
31 |
32 |
33 |
34 | 0
35 | 0
36 | 911
37 | 71
38 |
39 |
40 |
41 | -
42 |
43 |
44 | Qt::Horizontal
45 |
46 |
47 |
48 | 226
49 | 20
50 |
51 |
52 |
53 |
54 | -
55 |
56 |
57 |
58 | 微软雅黑
59 | 23
60 | 75
61 | true
62 |
63 |
64 |
65 | 项目一:正则表达式转lex
66 |
67 |
68 |
69 | -
70 |
71 |
72 | Qt::Horizontal
73 |
74 |
75 |
76 | 225
77 | 20
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | 0
88 | 300
89 | 911
90 | 361
91 |
92 |
93 |
94 | Qt::ScrollBarAlwaysOn
95 |
96 |
97 | Qt::ScrollBarAlwaysOn
98 |
99 |
100 | QAbstractScrollArea::AdjustToContents
101 |
102 |
103 |
104 |
105 |
106 | true
107 |
108 |
109 | 此处将会显示结果
110 |
111 |
112 |
113 |
114 |
115 | 0
116 | 240
117 | 911
118 | 61
119 |
120 |
121 |
122 | -
123 |
124 |
125 | Qt::Horizontal
126 |
127 |
128 |
129 | 148
130 | 20
131 |
132 |
133 |
134 |
135 | -
136 |
137 |
138 |
139 | 微软雅黑
140 | 15
141 |
142 |
143 |
144 | 开始分析
145 |
146 |
147 |
148 | -
149 |
150 |
151 | Qt::Horizontal
152 |
153 |
154 |
155 | 148
156 | 20
157 |
158 |
159 |
160 |
161 | -
162 |
163 |
164 |
165 | 微软雅黑
166 | 15
167 |
168 |
169 |
170 | NFA
171 |
172 |
173 |
174 | -
175 |
176 |
177 | Qt::Horizontal
178 |
179 |
180 |
181 | 148
182 | 20
183 |
184 |
185 |
186 |
187 | -
188 |
189 |
190 |
191 | 微软雅黑
192 | 15
193 |
194 |
195 |
196 | DFA
197 |
198 |
199 |
200 | -
201 |
202 |
203 | Qt::Horizontal
204 |
205 |
206 |
207 | 148
208 | 20
209 |
210 |
211 |
212 |
213 | -
214 |
215 |
216 |
217 | 微软雅黑
218 | 15
219 |
220 |
221 |
222 | DFA最小化
223 |
224 |
225 |
226 | -
227 |
228 |
229 | Qt::Horizontal
230 |
231 |
232 |
233 | 148
234 | 20
235 |
236 |
237 |
238 |
239 | -
240 |
241 |
242 |
243 | 微软雅黑
244 | 15
245 |
246 |
247 |
248 | 词法分析程序
249 |
250 |
251 |
252 | -
253 |
254 |
255 | Qt::Horizontal
256 |
257 |
258 |
259 | 148
260 | 20
261 |
262 |
263 |
264 |
265 | -
266 |
267 |
268 |
269 | 微软雅黑
270 | 15
271 |
272 |
273 |
274 | 查看lex文件
275 |
276 |
277 |
278 | -
279 |
280 |
281 | Qt::Horizontal
282 |
283 |
284 |
285 | 148
286 | 20
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 | -1
297 | 69
298 | 911
299 | 41
300 |
301 |
302 |
303 | -
304 |
305 |
306 | Qt::Horizontal
307 |
308 |
309 |
310 | 182
311 | 20
312 |
313 |
314 |
315 |
316 | -
317 |
318 |
319 |
320 | 12
321 |
322 |
323 |
324 | Qt::LeftToRight
325 |
326 |
327 | 姓名:李达良 班级:计科1班 学号:20203231004
328 |
329 |
330 | Qt::AlignCenter
331 |
332 |
333 |
334 | -
335 |
336 |
337 | Qt::Horizontal
338 |
339 |
340 |
341 | 181
342 | 20
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 | 0
353 | 230
354 | 911
355 | 16
356 |
357 |
358 |
359 |
360 | 微软雅黑
361 |
362 |
363 |
364 | 功能选择:输入正则表达式后,请先点击开始分析,再点击其他按钮查看结果,注意生成的NFA和DFA图不含关键词。
365 |
366 |
367 |
368 |
369 |
370 | 0
371 | 110
372 | 421
373 | 16
374 |
375 |
376 |
377 |
378 | 微软雅黑
379 |
380 |
381 |
382 | 请输入正则表达式,具体输入规则请点击右边“查看规则”按钮
383 |
384 |
385 |
386 |
387 |
388 | 0
389 | 300
390 | 911
391 | 361
392 |
393 |
394 |
395 | Qt::ScrollBarAlwaysOn
396 |
397 |
398 | Qt::ScrollBarAlwaysOn
399 |
400 |
401 | QAbstractScrollArea::AdjustToContents
402 |
403 |
404 |
405 |
406 |
407 | 660
408 | 190
409 | 101
410 | 28
411 |
412 |
413 |
414 |
415 | 微软雅黑
416 | 10
417 |
418 |
419 |
420 | 上传正则表达式
421 |
422 |
423 |
424 |
425 |
426 | 780
427 | 190
428 | 111
429 | 28
430 |
431 |
432 |
433 |
434 | 微软雅黑
435 | 10
436 |
437 |
438 |
439 | 下载正则表达式
440 |
441 |
442 |
443 |
444 |
445 | 0
446 | 130
447 | 651
448 | 91
449 |
450 |
451 |
452 |
453 | 微软雅黑
454 | 10
455 |
456 |
457 |
458 | <html><head/><body><p><br/></p></body></html>
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 | 660
471 | 160
472 | 231
473 | 28
474 |
475 |
476 |
477 |
478 | 微软雅黑
479 | 12
480 |
481 |
482 |
483 | 查看规则
484 |
485 |
486 |
487 |
488 |
489 | 660
490 | 140
491 | 221
492 | 16
493 |
494 |
495 |
496 |
497 | 微软雅黑
498 | 10
499 |
500 |
501 |
502 | 若词法分析忽略大小写,请勾选
503 |
504 |
505 | false
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
--------------------------------------------------------------------------------
/code/SLR1Processer/.qmake.stash:
--------------------------------------------------------------------------------
1 | QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
2 | QMAKE_CXX.QMAKE_MSC_VER = 1932
3 | QMAKE_CXX.QMAKE_MSC_FULL_VER = 193231329
4 | QMAKE_CXX.COMPILER_MACROS = \
5 | QT_COMPILER_STDCXX \
6 | QMAKE_MSC_VER \
7 | QMAKE_MSC_FULL_VER
8 | QMAKE_CXX.INCDIRS = \
9 | "D:\\Program Files (x86)\\VS PRO\\VC\\Tools\\MSVC\\14.32.31326\\ATLMFC\\include" \
10 | "D:\\Program Files (x86)\\VS PRO\\VC\\Tools\\MSVC\\14.32.31326\\include" \
11 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" \
12 | "D:\\Windows Kits\\10\\include\\10.0.19041.0\\ucrt" \
13 | "D:\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\shared" \
14 | "D:\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\um" \
15 | "D:\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\winrt" \
16 | "D:\\Windows Kits\\10\\\\include\\10.0.19041.0\\\\cppwinrt"
17 | QMAKE_CXX.LIBDIRS = \
18 | "D:\\Program Files (x86)\\VS PRO\\VC\\Tools\\MSVC\\14.32.31326\\ATLMFC\\lib\\x64" \
19 | "D:\\Program Files (x86)\\VS PRO\\VC\\Tools\\MSVC\\14.32.31326\\lib\\x64" \
20 | "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x64" \
21 | "D:\\Windows Kits\\10\\lib\\10.0.19041.0\\ucrt\\x64" \
22 | "D:\\Windows Kits\\10\\\\lib\\10.0.19041.0\\\\um\\x64"
23 |
--------------------------------------------------------------------------------
/code/SLR1Processer/SLR1Processer.pro:
--------------------------------------------------------------------------------
1 | QT += core gui
2 |
3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
4 |
5 | CONFIG += c++11
6 |
7 | # You can make your code fail to compile if it uses deprecated APIs.
8 | # In order to do so, uncomment the following line.
9 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10 |
11 | SOURCES += \
12 | main.cpp \
13 | widget.cpp
14 |
15 | HEADERS += \
16 | widget.h
17 |
18 | FORMS += \
19 | widget.ui
20 |
21 | # Default rules for deployment.
22 | qnx: target.path = /tmp/$${TARGET}/bin
23 | else: unix:!android: target.path = /opt/$${TARGET}/bin
24 | !isEmpty(target.path): INSTALLS += target
25 |
--------------------------------------------------------------------------------
/code/SLR1Processer/SLR1Processer.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {edf33a81-1efa-46b4-87bb-6e8eaf4d1312}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | false
41 | true
42 | false
43 | 0
44 | true
45 | true
46 | 0
47 | 8
48 | true
49 | false
50 | 0
51 | true
52 | true
53 | true
54 | *.md, *.MD, Makefile
55 | false
56 | true
57 |
58 |
59 |
60 | ProjectExplorer.Project.PluginSettings
61 |
62 |
63 | true
64 | false
65 | true
66 | true
67 | true
68 | true
69 |
70 |
71 | 0
72 | true
73 |
74 | -fno-delayed-template-parsing
75 |
76 | true
77 | Builtin.BuildSystem
78 |
79 | true
80 | true
81 | Builtin.DefaultTidyAndClazy
82 | 8
83 |
84 |
85 |
86 | true
87 |
88 |
89 |
90 |
91 | ProjectExplorer.Project.Target.0
92 |
93 | Desktop
94 | Desktop Qt 5.12.12 MinGW 64-bit
95 | Desktop Qt 5.12.12 MinGW 64-bit
96 | qt.qt5.51212.win64_mingw73_kit
97 | 1
98 | 0
99 | 0
100 |
101 | 0
102 | F:\Code\QTproject\build-SLR1Processer-Desktop_Qt_5_12_12_MinGW_64_bit-Debug
103 | F:/Code/QTproject/build-SLR1Processer-Desktop_Qt_5_12_12_MinGW_64_bit-Debug
104 |
105 |
106 | true
107 | QtProjectManager.QMakeBuildStep
108 | false
109 |
110 |
111 |
112 | true
113 | Qt4ProjectManager.MakeStep
114 |
115 | 2
116 | Build
117 | Build
118 | ProjectExplorer.BuildSteps.Build
119 |
120 |
121 |
122 | true
123 | Qt4ProjectManager.MakeStep
124 | clean
125 |
126 | 1
127 | Clean
128 | Clean
129 | ProjectExplorer.BuildSteps.Clean
130 |
131 | 2
132 | false
133 |
134 |
135 | Debug
136 | Qt4ProjectManager.Qt4BuildConfiguration
137 | 2
138 |
139 |
140 | F:\Code\QTproject\build-SLR1Processer-Desktop_Qt_5_12_12_MinGW_64_bit-Release
141 | F:/Code/QTproject/build-SLR1Processer-Desktop_Qt_5_12_12_MinGW_64_bit-Release
142 |
143 |
144 | true
145 | QtProjectManager.QMakeBuildStep
146 | false
147 |
148 |
149 |
150 | true
151 | Qt4ProjectManager.MakeStep
152 |
153 | 2
154 | Build
155 | Build
156 | ProjectExplorer.BuildSteps.Build
157 |
158 |
159 |
160 | true
161 | Qt4ProjectManager.MakeStep
162 | clean
163 |
164 | 1
165 | Clean
166 | Clean
167 | ProjectExplorer.BuildSteps.Clean
168 |
169 | 2
170 | false
171 |
172 |
173 | Release
174 | Qt4ProjectManager.Qt4BuildConfiguration
175 | 0
176 | 0
177 |
178 |
179 | 0
180 | F:\Code\QTproject\build-SLR1Processer-Desktop_Qt_5_12_12_MinGW_64_bit-Profile
181 | F:/Code/QTproject/build-SLR1Processer-Desktop_Qt_5_12_12_MinGW_64_bit-Profile
182 |
183 |
184 | true
185 | QtProjectManager.QMakeBuildStep
186 | false
187 |
188 |
189 |
190 | true
191 | Qt4ProjectManager.MakeStep
192 |
193 | 2
194 | Build
195 | Build
196 | ProjectExplorer.BuildSteps.Build
197 |
198 |
199 |
200 | true
201 | Qt4ProjectManager.MakeStep
202 | clean
203 |
204 | 1
205 | Clean
206 | Clean
207 | ProjectExplorer.BuildSteps.Clean
208 |
209 | 2
210 | false
211 |
212 |
213 | Profile
214 | Qt4ProjectManager.Qt4BuildConfiguration
215 | 0
216 | 0
217 | 0
218 |
219 | 3
220 |
221 |
222 | 0
223 | Deploy
224 | Deploy
225 | ProjectExplorer.BuildSteps.Deploy
226 |
227 | 1
228 |
229 | false
230 | ProjectExplorer.DefaultDeployConfiguration
231 |
232 | 1
233 |
234 | true
235 | true
236 | true
237 |
238 | 2
239 |
240 | Qt4ProjectManager.Qt4RunConfiguration:F:/Code/QTproject/SLR1Processer/SLR1Processer.pro
241 | F:/Code/QTproject/SLR1Processer/SLR1Processer.pro
242 | false
243 | true
244 | true
245 | false
246 | true
247 | F:/Code/QTproject/build-SLR1Processer-Desktop_Qt_5_12_12_MinGW_64_bit-Release
248 |
249 | 1
250 |
251 |
252 |
253 | ProjectExplorer.Project.TargetCount
254 | 1
255 |
256 |
257 | ProjectExplorer.Project.Updater.FileVersion
258 | 22
259 |
260 |
261 | Version
262 | 22
263 |
264 |
265 |
--------------------------------------------------------------------------------
/code/SLR1Processer/SLR1Processer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.2.32526.322
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SLR1Processer", "SLR1Processer.vcxproj", "{8363F4F8-7880-37CC-9C2D-17586D2182EB}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {8363F4F8-7880-37CC-9C2D-17586D2182EB}.Debug|x64.ActiveCfg = Debug|x64
15 | {8363F4F8-7880-37CC-9C2D-17586D2182EB}.Debug|x64.Build.0 = Debug|x64
16 | {8363F4F8-7880-37CC-9C2D-17586D2182EB}.Release|x64.ActiveCfg = Release|x64
17 | {8363F4F8-7880-37CC-9C2D-17586D2182EB}.Release|x64.Build.0 = Release|x64
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {A91398C4-87D9-4A12-85A0-E50A5C3AF138}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/code/SLR1Processer/SLR1Processer.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Release
6 | x64
7 |
8 |
9 | Debug
10 | x64
11 |
12 |
13 |
14 | {8363F4F8-7880-37CC-9C2D-17586D2182EB}
15 | SLR1Processer
16 | QtVS_v304
17 | 10.0.19041.0
18 | 10.0.19041.0
19 | $(MSBuildProjectDirectory)\QtMsBuild
20 |
21 |
22 | v142
23 | release\
24 | false
25 | NotSet
26 | Application
27 | release\
28 | SLR1Processer
29 |
30 |
31 | v142
32 | debug\
33 | false
34 | NotSet
35 | Application
36 | debug\
37 | SLR1Processer
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | debug\debug\SLR1Processertruerelease\release\SLR1Processertruefalse5.12.12_msvc2017_64core;gui;widgets5.12.12_msvc2017_64core;gui;widgets
48 |
49 |
50 |
51 | GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;release;/include;%(AdditionalIncludeDirectories)
52 | -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)
53 | release\
54 | false
55 | None
56 | 4577;4467;%(DisableSpecificWarnings)
57 | Sync
58 | release\
59 | MaxSpeed
60 | _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;NDEBUG;%(PreprocessorDefinitions)
61 | false
62 |
63 | MultiThreadedDLL
64 | true
65 | true
66 | Level3
67 | true
68 |
69 | shell32.lib;%(AdditionalDependencies)
70 | C:\openssl\lib;C:\Utils\my_sql\mysql-5.6.11-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories)
71 | "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)
72 | true
73 | false
74 | true
75 | false
76 | $(OutDir)\SLR1Processer.exe
77 | true
78 | Windows
79 | true
80 |
81 |
82 | Unsigned
83 | None
84 | 0
85 |
86 |
87 | _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_NO_DEBUG;%(PreprocessorDefinitions)
88 |
89 | msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h
90 |
91 |
92 | GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;debug;/include;%(AdditionalIncludeDirectories)
93 | -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)
94 | debug\
95 | false
96 | ProgramDatabase
97 | 4577;4467;%(DisableSpecificWarnings)
98 | Sync
99 | debug\
100 | Disabled
101 | _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;%(PreprocessorDefinitions)
102 | false
103 | MultiThreadedDebugDLL
104 | true
105 | true
106 | Level3
107 | true
108 |
109 | shell32.lib;%(AdditionalDependencies)
110 | C:\openssl\lib;C:\Utils\my_sql\mysql-5.6.11-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories)
111 | "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)
112 | true
113 | true
114 | true
115 | $(OutDir)\SLR1Processer.exe
116 | true
117 | Windows
118 | true
119 |
120 |
121 | Unsigned
122 | None
123 | 0
124 |
125 |
126 | _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;_DEBUG;%(PreprocessorDefinitions)
127 |
128 | msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 | Document
148 | true
149 | $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)
150 | cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >debug\moc_predefs.h
151 | Generate moc_predefs.h
152 | debug\moc_predefs.h;%(Outputs)
153 |
154 |
155 | Document
156 | $(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)
157 | cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h
158 | Generate moc_predefs.h
159 | release\moc_predefs.h;%(Outputs)
160 | true
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
--------------------------------------------------------------------------------
/code/SLR1Processer/SLR1Processer.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
6 | ui
7 | false
8 |
9 |
10 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
11 | ui
12 | false
13 |
14 |
15 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
16 | cpp;c;cxx;moc;h;def;odl;idl;res;
17 |
18 |
19 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
20 | cpp;c;cxx;moc;h;def;odl;idl;res;
21 |
22 |
23 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
24 | h;hpp;hxx;hm;inl;inc;xsd
25 |
26 |
27 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
28 | h;hpp;hxx;hm;inl;inc;xsd
29 |
30 |
31 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
32 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
33 |
34 |
35 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
36 | cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx
37 |
38 |
39 |
40 |
41 | Source Files
42 |
43 |
44 | Source Files
45 |
46 |
47 |
48 |
49 | Header Files
50 |
51 |
52 |
53 |
54 | Generated Files
55 |
56 |
57 | Generated Files
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | Form Files
66 |
67 |
68 |
--------------------------------------------------------------------------------
/code/SLR1Processer/SLR1Processer.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 2024-05-12T15:41:09.9748838Z
6 |
7 |
8 | 2024-05-12T15:41:10.0489016Z
9 |
10 |
--------------------------------------------------------------------------------
/code/SLR1Processer/main.cpp:
--------------------------------------------------------------------------------
1 | #include "widget.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | Widget w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/code/SLR1Processer/readme.txt:
--------------------------------------------------------------------------------
1 | 1. main.cpp 主程序入口
2 | 2. ui_widget.h 和 widget.h 为 头文件
3 | 3. widget.ui 为操作界面UI文件
4 | 4. widget.cpp 是核心代码程序
5 | 5. SLR1Processer.pro 是 QT 程序入口
6 | 6. SLR1Processer.sln 是 VS2019 入口,当VS装入QT插件后,即可快速打开
7 | 7. 剩余文件为VS缓存文件,建议不要删除,可以快速打开。
--------------------------------------------------------------------------------
/code/SLR1Processer/widget.h:
--------------------------------------------------------------------------------
1 | #ifndef WIDGET_H
2 | #define WIDGET_H
3 |
4 | #include
5 |
6 | QT_BEGIN_NAMESPACE
7 | namespace Ui { class Widget; }
8 | QT_END_NAMESPACE
9 |
10 | class Widget : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | Widget(QWidget *parent = nullptr);
16 | ~Widget();
17 |
18 | private slots:
19 | void on_pushButton_7_clicked();
20 |
21 | void on_pushButton_3_clicked();
22 |
23 | void on_pushButton_4_clicked();
24 |
25 | void on_pushButton_5_clicked();
26 |
27 | void on_pushButton_6_clicked();
28 |
29 | void on_pushButton_clicked();
30 |
31 | void on_pushButton_2_clicked();
32 |
33 | void on_pushButton_8_clicked();
34 |
35 | void on_pushButton_9_clicked();
36 |
37 | private:
38 | Ui::Widget *ui;
39 | };
40 | #endif // WIDGET_H
41 |
--------------------------------------------------------------------------------
/code/SLR1Processer/widget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Widget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 1773
10 | 761
11 |
12 |
13 |
14 | 项目2 author:李达良
15 |
16 |
17 |
18 |
19 | 20
20 | 10
21 | 1731
22 | 741
23 |
24 |
25 |
26 |
27 |
28 | 0
29 | 0
30 | 1731
31 | 51
32 |
33 |
34 |
35 | -
36 |
37 |
38 | Qt::Horizontal
39 |
40 |
41 |
42 | 226
43 | 20
44 |
45 |
46 |
47 |
48 | -
49 |
50 |
51 |
52 | 微软雅黑
53 | 23
54 | 75
55 | true
56 |
57 |
58 |
59 | 项目二:SLR(1)分析生成器及语法树生成
60 |
61 |
62 |
63 | -
64 |
65 |
66 | Qt::Horizontal
67 |
68 |
69 |
70 | 225
71 | 20
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | 0
82 | 50
83 | 1731
84 | 41
85 |
86 |
87 |
88 | -
89 |
90 |
91 | Qt::Horizontal
92 |
93 |
94 |
95 | 182
96 | 20
97 |
98 |
99 |
100 |
101 | -
102 |
103 |
104 |
105 | 12
106 |
107 |
108 |
109 | Qt::LeftToRight
110 |
111 |
112 | 姓名:李达良 班级:计科1班 学号:20203231004
113 |
114 |
115 | Qt::AlignCenter
116 |
117 |
118 |
119 | -
120 |
121 |
122 | Qt::Horizontal
123 |
124 |
125 |
126 | 181
127 | 20
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 | 0
138 | 90
139 | 251
140 | 221
141 |
142 |
143 |
144 | false
145 |
146 |
147 |
148 |
149 | 0
150 | 0
151 | 251
152 | 41
153 |
154 |
155 |
156 | -
157 |
158 |
159 | Qt::Horizontal
160 |
161 |
162 |
163 | 72
164 | 20
165 |
166 |
167 |
168 |
169 | -
170 |
171 |
172 | 文法输入编辑
173 |
174 |
175 |
176 | -
177 |
178 |
179 | 查看输入规则
180 |
181 |
182 |
183 | -
184 |
185 |
186 | Qt::Horizontal
187 |
188 |
189 |
190 | 71
191 | 20
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 | 10
202 | 80
203 | 231
204 | 131
205 |
206 |
207 |
208 |
209 |
210 |
211 | 0
212 | 40
213 | 251
214 | 41
215 |
216 |
217 |
218 | -
219 |
220 |
221 | Qt::Horizontal
222 |
223 |
224 |
225 | 72
226 | 20
227 |
228 |
229 |
230 |
231 | -
232 |
233 |
234 | 打开
235 |
236 |
237 |
238 | -
239 |
240 |
241 | Qt::Horizontal
242 |
243 |
244 |
245 | 40
246 | 20
247 |
248 |
249 |
250 |
251 | -
252 |
253 |
254 | 保存
255 |
256 |
257 |
258 | -
259 |
260 |
261 | Qt::Horizontal
262 |
263 |
264 |
265 | 71
266 | 20
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 | -1
278 | 309
279 | 251
280 | 221
281 |
282 |
283 |
284 |
285 |
286 | -1
287 | 0
288 | 251
289 | 41
290 |
291 |
292 |
293 | -
294 |
295 |
296 | Qt::Horizontal
297 |
298 |
299 |
300 | 28
301 | 20
302 |
303 |
304 |
305 |
306 | -
307 |
308 |
309 | First集合求解
310 |
311 |
312 |
313 | -
314 |
315 |
316 | 求解
317 |
318 |
319 |
320 | -
321 |
322 |
323 | Qt::Horizontal
324 |
325 |
326 |
327 | 28
328 | 20
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 | 10
339 | 40
340 | 231
341 | 171
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 | -1
350 | 529
351 | 251
352 | 211
353 |
354 |
355 |
356 |
357 |
358 | -1
359 | -1
360 | 251
361 | 41
362 |
363 |
364 |
365 | -
366 |
367 |
368 | Qt::Horizontal
369 |
370 |
371 |
372 | 25
373 | 20
374 |
375 |
376 |
377 |
378 | -
379 |
380 |
381 | Follow集合求解
382 |
383 |
384 |
385 | -
386 |
387 |
388 | 求解
389 |
390 |
391 |
392 | -
393 |
394 |
395 | Qt::Horizontal
396 |
397 |
398 |
399 | 25
400 | 20
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 | 10
411 | 40
412 | 231
413 | 161
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 | 249
422 | 89
423 | 1051
424 | 321
425 |
426 |
427 |
428 |
429 |
430 | -1
431 | -1
432 | 1051
433 | 41
434 |
435 |
436 |
437 | -
438 |
439 |
440 | Qt::Horizontal
441 |
442 |
443 |
444 | 437
445 | 20
446 |
447 |
448 |
449 |
450 | -
451 |
452 |
453 | LR(0)DFA图
454 |
455 |
456 |
457 | -
458 |
459 |
460 | 开始生成
461 |
462 |
463 |
464 | -
465 |
466 |
467 | Qt::Horizontal
468 |
469 |
470 |
471 | 437
472 | 20
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 | 220
483 | 40
484 | 821
485 | 271
486 |
487 |
488 |
489 |
490 |
491 |
492 | 10
493 | -30
494 | 211
495 | 351
496 |
497 |
498 |
499 |
500 |
501 | 0
502 | 40
503 | 211
504 | 41
505 |
506 |
507 |
508 | -
509 |
510 |
511 | Qt::Horizontal
512 |
513 |
514 |
515 | 46
516 | 20
517 |
518 |
519 |
520 |
521 | -
522 |
523 |
524 | 生成提示
525 |
526 |
527 |
528 | -
529 |
530 |
531 | Qt::Horizontal
532 |
533 |
534 |
535 | 45
536 | 20
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 | 10
547 | 70
548 | 191
549 | 271
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 | 249
559 | 409
560 | 1051
561 | 331
562 |
563 |
564 |
565 |
566 |
567 | -1
568 | -1
569 | 211
570 | 331
571 |
572 |
573 |
574 |
575 |
576 | 0
577 | 40
578 | 211
579 | 41
580 |
581 |
582 |
583 | -
584 |
585 |
586 | Qt::Horizontal
587 |
588 |
589 |
590 | 46
591 | 20
592 |
593 |
594 |
595 |
596 | -
597 |
598 |
599 | 分析结果
600 |
601 |
602 |
603 | -
604 |
605 |
606 | Qt::Horizontal
607 |
608 |
609 |
610 | 45
611 | 20
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 | 10
622 | 70
623 | 191
624 | 251
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 | -1
633 | -1
634 | 1051
635 | 41
636 |
637 |
638 |
639 |
640 | 0
641 |
642 |
643 | 0
644 |
645 | -
646 |
647 |
648 | Qt::Horizontal
649 |
650 |
651 |
652 | 425
653 | 20
654 |
655 |
656 |
657 |
658 | -
659 |
660 |
661 | SLR(1)文法分析
662 |
663 |
664 |
665 | -
666 |
667 |
668 | 开始分析
669 |
670 |
671 |
672 | -
673 |
674 |
675 | Qt::Horizontal
676 |
677 |
678 |
679 | 425
680 | 20
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 | 220
691 | 70
692 | 821
693 | 251
694 |
695 |
696 |
697 |
698 |
699 |
700 | 210
701 | 40
702 | 841
703 | 41
704 |
705 |
706 |
707 | -
708 |
709 |
710 | Qt::Horizontal
711 |
712 |
713 |
714 | 367
715 | 20
716 |
717 |
718 |
719 |
720 | -
721 |
722 |
723 | SLR(1)分析表(仅当分析成功展示)
724 |
725 |
726 |
727 | -
728 |
729 |
730 | Qt::Horizontal
731 |
732 |
733 |
734 | 366
735 | 20
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 | 1299
747 | 89
748 | 431
749 | 651
750 |
751 |
752 |
753 |
754 |
755 | 6
756 | 39
757 | 421
758 | 601
759 |
760 |
761 |
762 | 0
763 |
764 |
765 |
766 | 生成提示
767 |
768 |
769 |
770 |
771 | 0
772 | 0
773 | 411
774 | 571
775 |
776 |
777 |
778 | true
779 |
780 |
781 | 本模块用于语法树生成,具体步骤如下:
782 | 1. 先在软件最左边模块输入文法
783 | 2. 准备对应文法的语法树语义函数文件(txt格式),语义函数规则如下:
784 | a. 每一行都与文法一一对应,即第一行输入第一行文法的语义函数,第二行输入第二行文法语义函数,以此类推。
785 | b.针对每一行文法的“->”右边部分,每个标识符对应-1 0 1其中一个,具体含义如下:
786 | -1 代表不生成这个节点
787 | 0 代表是根
788 | 1+ 代表第几个孩子,孩子的顺序
789 | c.如果文法存在左递归,程序自动默认规约的字符的根节点。
790 | 3. 完成以上步骤后,点击代码生成,选择程序生成的文件夹和语义函数文件得到语法树生成代码,可点击上面“代码生成”按钮查看。
791 | 4. 自行编译运行代码,得到语法树文件(tree.out),点击语法树展示即可展示语法树。
792 |
793 |
794 |
795 |
796 |
797 | 代码生成
798 |
799 |
800 |
801 |
802 | 0
803 | 0
804 | 411
805 | 571
806 |
807 |
808 |
809 |
810 |
811 |
812 | 语法树展示
813 |
814 |
815 |
816 |
817 | 0
818 | 0
819 | 421
820 | 581
821 |
822 |
823 |
824 | true
825 |
826 |
827 |
828 | 树形结构
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 | 130
838 | 10
839 | 60
840 | 23
841 |
842 |
843 |
844 | 语法树生成
845 |
846 |
847 |
848 |
849 |
850 | 200
851 | 10
852 | 75
853 | 23
854 |
855 |
856 |
857 | 代码生成
858 |
859 |
860 |
861 |
862 |
863 | 280
864 | 10
865 | 101
866 | 23
867 |
868 |
869 |
870 | 可视化语法树
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
--------------------------------------------------------------------------------
/code/编译说明.txt:
--------------------------------------------------------------------------------
1 | 编译环境:
2 | QT Creator 5.0.2
3 | QT 5.12.12 MinGW 64-bit
4 | 编译说明:
5 | 1. 使用QT Creator IDE;
6 | 2. 导入对应的项目;
7 | 3. 点击左下角运行按钮即可编译完成并运行。
8 | 注意:不建议使用命令行进行编译,可能会出现莫名奇妙的问题,在此不提供命令行编译编译的方式,可自行搜索。
--------------------------------------------------------------------------------
/docs/报告设计书-pdf版本.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/docs/报告设计书-pdf版本.pdf
--------------------------------------------------------------------------------
/docs/报告设计书-word版本.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/docs/报告设计书-word版本.doc
--------------------------------------------------------------------------------
/test/1. 任务一测试文本及程序/1. 测试文本/tiny正则表达式.txt:
--------------------------------------------------------------------------------
1 | if|then|else|end|repeat|until|read|write
2 | \+\ | - | \*\ | / | % | < | <> | <= | >= | > | = | ; | := | \(\ | \)\
3 | PLUS | MINUS | MULTIPLY | DIVIDE | MOD | LT| NE | LTEQ | RTEQ | RT | EQ | SEMI | ASSIGN | LPAN | RPAN
4 | letter(letter|num)*
5 | num num*
6 | {~}
--------------------------------------------------------------------------------
/test/1. 任务一测试文本及程序/1. 测试文本/tiny示例程序.tny:
--------------------------------------------------------------------------------
1 | read xXx; {read和标识符判断}
2 | if ( xXx < yYy ) then {if和<判断}
3 | repeat{repeat判断}
4 | xXx := (xXx + 1) * 1 - 0 /1{+-*/的判断}
5 | until xXx = yYy{until和=判断}
6 | else{else判断}
7 | write 001+123 % 2{%和write、数字的判断}
8 | end;{end判断}
9 | read z1;
10 | {各种符号判断}
11 | if z1 <= 1000 then
12 | z1 := 0
13 | else
14 | z1 := 1
15 | end;
16 | if z1 <> 1000 then
17 | z1 := 0
18 | else
19 | z1 := 1
20 | end;
21 | if z1 >= 1000 then
22 | z1 := 0
23 | else
24 | z1 := 1
25 | end;
26 | if z1 > 1000 then
27 | z1 := 0
28 | else
29 | z1 := 1
30 | end
--------------------------------------------------------------------------------
/test/1. 任务一测试文本及程序/2. 程序生成文件/_lexer.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/1. 任务一测试文本及程序/2. 程序生成文件/_lexer.c
--------------------------------------------------------------------------------
/test/1. 任务一测试文本及程序/2. 程序生成文件/_lexer.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/1. 任务一测试文本及程序/2. 程序生成文件/_lexer.exe
--------------------------------------------------------------------------------
/test/1. 任务一测试文本及程序/2. 程序生成文件/_sample.tny:
--------------------------------------------------------------------------------
1 | read xXx; {read和标识符判断}
2 | if ( xXx < yYy ) then {if和<判断}
3 | repeat{repeat判断}
4 | xXx := (xXx + 1) * 1 - 0 /1{+-*/的判断}
5 | until xXx = yYy{until和=判断}
6 | else{else判断}
7 | write 001+123 % 2{%和write、数字的判断}
8 | end;{end判断}
9 | read z1;
10 | {各种符号判断}
11 | if z1 <= 1000 then
12 | z1 := 0
13 | else
14 | z1 := 1
15 | end;
16 | if z1 <> 1000 then
17 | z1 := 0
18 | else
19 | z1 := 1
20 | end;
21 | if z1 >= 1000 then
22 | z1 := 0
23 | else
24 | z1 := 1
25 | end;
26 | if z1 > 1000 then
27 | z1 := 0
28 | else
29 | z1 := 1
30 | end
--------------------------------------------------------------------------------
/test/1. 任务一测试文本及程序/2. 程序生成文件/output.lex:
--------------------------------------------------------------------------------
1 | read:read
2 | ID:xXx
3 | SEMI:;
4 | if:if
5 | LPAN:(
6 | ID:xXx
7 | LT:<
8 | ID:yYy
9 | RPAN:)
10 | then:then
11 | repeat:repeat
12 | ID:xXx
13 | ASSIGN::=
14 | LPAN:(
15 | ID:xXx
16 | PLUS:+
17 | NUMBER:1
18 | RPAN:)
19 | MULTIPLY:*
20 | NUMBER:1
21 | MINUS:-
22 | NUMBER:0
23 | DIVIDE:/
24 | NUMBER:1
25 | until:until
26 | ID:xXx
27 | EQ:=
28 | ID:yYy
29 | else:else
30 | write:write
31 | NUMBER:001
32 | PLUS:+
33 | NUMBER:123
34 | MOD:%
35 | NUMBER:2
36 | end:end
37 | SEMI:;
38 | read:read
39 | ID:z1
40 | SEMI:;
41 | if:if
42 | ID:z1
43 | LTEQ:<=
44 | NUMBER:1000
45 | then:then
46 | ID:z1
47 | ASSIGN::=
48 | NUMBER:0
49 | else:else
50 | ID:z1
51 | ASSIGN::=
52 | NUMBER:1
53 | end:end
54 | SEMI:;
55 | if:if
56 | ID:z1
57 | NE:<>
58 | NUMBER:1000
59 | then:then
60 | ID:z1
61 | ASSIGN::=
62 | NUMBER:0
63 | else:else
64 | ID:z1
65 | ASSIGN::=
66 | NUMBER:1
67 | end:end
68 | SEMI:;
69 | if:if
70 | ID:z1
71 | RTEQ:>=
72 | NUMBER:1000
73 | then:then
74 | ID:z1
75 | ASSIGN::=
76 | NUMBER:0
77 | else:else
78 | ID:z1
79 | ASSIGN::=
80 | NUMBER:1
81 | end:end
82 | SEMI:;
83 | if:if
84 | ID:z1
85 | RT:>
86 | NUMBER:1000
87 | then:then
88 | ID:z1
89 | ASSIGN::=
90 | NUMBER:0
91 | else:else
92 | ID:z1
93 | ASSIGN::=
94 | NUMBER:1
95 | end:end
96 | EOF:EOF
--------------------------------------------------------------------------------
/test/2. 任务二测试文本及程序/1. 测试文本/tiny文法.txt:
--------------------------------------------------------------------------------
1 | program | stmt-sequence | statement | if-stmt | repeat-stmt | assign-stmt | read-stmt | write-stmt | exp | simple-exp | comparison-op | addop | term | mulop | factor
2 | SEMI | if | then | end | else | repeat | until | ASSIGN | read | ID | number | write | LT | EQ | LTEQ | NE | RTEQ | RT | PLUS | MINUS | MULTIPLY | DIVIDE | MOD | LPAN | RPAN | NUMBER
3 | program -> stmt-sequence
4 | stmt-sequence -> stmt-sequence SEMI statement
5 | stmt-sequence -> statement
6 | statement -> if-stmt
7 | statement -> repeat-stmt
8 | statement -> assign-stmt
9 | statement -> read-stmt
10 | statement -> write-stmt
11 | if-stmt -> if exp then stmt-sequence end
12 | if-stmt -> if exp then stmt-sequence else stmt-sequence end
13 | repeat-stmt -> repeat stmt-sequence until exp
14 | assign-stmt -> ID ASSIGN exp
15 | read-stmt -> read ID
16 | write-stmt -> write exp
17 | exp -> simple-exp comparison-op simple-exp
18 | exp -> simple-exp
19 | comparison-op -> LT
20 | comparison-op -> EQ
21 | comparison-op -> LTEQ
22 | comparison-op -> NE
23 | comparison-op -> RTEQ
24 | comparison-op -> RT
25 | simple-exp -> simple-exp addop term
26 | simple-exp -> term
27 | addop -> PLUS
28 | addop -> MINUS
29 | term -> term mulop factor
30 | term -> factor
31 | mulop -> MULTIPLY
32 | mulop -> DIVIDE
33 | mulop -> MOD
34 | factor -> LPAN exp RPAN
35 | factor -> NUMBER
36 | factor -> ID
--------------------------------------------------------------------------------
/test/2. 任务二测试文本及程序/1. 测试文本/语义函数.txt:
--------------------------------------------------------------------------------
1 | 0
2 | 0 -1 1
3 | 0 0
4 | 0
5 | 0
6 | 0
7 | 0
8 | 0
9 | 0 1 -1 2 -1
10 | 0 1 -1 2 -1 3 -1
11 | 0 1 -1 2
12 | 1 0 2
13 | 0 1
14 | 0 1
15 | 1 0 2
16 | 0
17 | 0
18 | 0
19 | 0
20 | 0
21 | 0
22 | 0
23 | 1 0 2
24 | 0
25 | 0
26 | 0
27 | 1 0 2
28 | 0
29 | 0
30 | 0
31 | 0
32 | -1 0 -1
33 | 0
34 | 0
--------------------------------------------------------------------------------
/test/2. 任务二测试文本及程序/2. 程序生成文件/SLR1Str.txt:
--------------------------------------------------------------------------------
1 | SLRUnit
2 | {
3 | Key: ID
4 | Value: s1
5 | Key: assign-stmt
6 | Value: 2
7 | Key: if
8 | Value: s3
9 | Key: if-stmt
10 | Value: 4
11 | Key: read
12 | Value: s5
13 | Key: read-stmt
14 | Value: 6
15 | Key: repeat
16 | Value: s7
17 | Key: repeat-stmt
18 | Value: 8
19 | Key: statement
20 | Value: 9
21 | Key: stmt-sequence
22 | Value: 10
23 | Key: write
24 | Value: s11
25 | Key: write-stmt
26 | Value: 12
27 | }
28 | SLRUnit
29 | {
30 | Key: ASSIGN
31 | Value: s13
32 | }
33 | SLRUnit
34 | {
35 | Key: $
36 | Value: r(statement->assign-stmt)
37 | Key: SEMI
38 | Value: r(statement->assign-stmt)
39 | Key: else
40 | Value: r(statement->assign-stmt)
41 | Key: end
42 | Value: r(statement->assign-stmt)
43 | Key: until
44 | Value: r(statement->assign-stmt)
45 | }
46 | SLRUnit
47 | {
48 | Key: ID
49 | Value: s14
50 | Key: LPAN
51 | Value: s15
52 | Key: NUMBER
53 | Value: s16
54 | Key: exp
55 | Value: 40
56 | Key: factor
57 | Value: 18
58 | Key: simple-exp
59 | Value: 19
60 | Key: term
61 | Value: 20
62 | }
63 | SLRUnit
64 | {
65 | Key: $
66 | Value: r(statement->if-stmt)
67 | Key: SEMI
68 | Value: r(statement->if-stmt)
69 | Key: else
70 | Value: r(statement->if-stmt)
71 | Key: end
72 | Value: r(statement->if-stmt)
73 | Key: until
74 | Value: r(statement->if-stmt)
75 | }
76 | SLRUnit
77 | {
78 | Key: ID
79 | Value: s43
80 | }
81 | SLRUnit
82 | {
83 | Key: $
84 | Value: r(statement->read-stmt)
85 | Key: SEMI
86 | Value: r(statement->read-stmt)
87 | Key: else
88 | Value: r(statement->read-stmt)
89 | Key: end
90 | Value: r(statement->read-stmt)
91 | Key: until
92 | Value: r(statement->read-stmt)
93 | }
94 | SLRUnit
95 | {
96 | Key: ID
97 | Value: s1
98 | Key: assign-stmt
99 | Value: 2
100 | Key: if
101 | Value: s3
102 | Key: if-stmt
103 | Value: 4
104 | Key: read
105 | Value: s5
106 | Key: read-stmt
107 | Value: 6
108 | Key: repeat
109 | Value: s7
110 | Key: repeat-stmt
111 | Value: 8
112 | Key: statement
113 | Value: 9
114 | Key: stmt-sequence
115 | Value: 44
116 | Key: write
117 | Value: s11
118 | Key: write-stmt
119 | Value: 12
120 | }
121 | SLRUnit
122 | {
123 | Key: $
124 | Value: r(statement->repeat-stmt)
125 | Key: SEMI
126 | Value: r(statement->repeat-stmt)
127 | Key: else
128 | Value: r(statement->repeat-stmt)
129 | Key: end
130 | Value: r(statement->repeat-stmt)
131 | Key: until
132 | Value: r(statement->repeat-stmt)
133 | }
134 | SLRUnit
135 | {
136 | Key: $
137 | Value: r(stmt-sequence->statement)
138 | Key: SEMI
139 | Value: r(stmt-sequence->statement)
140 | Key: else
141 | Value: r(stmt-sequence->statement)
142 | Key: end
143 | Value: r(stmt-sequence->statement)
144 | Key: until
145 | Value: r(stmt-sequence->statement)
146 | }
147 | SLRUnit
148 | {
149 | Key: $
150 | Value: ACCEPT
151 | Key: SEMI
152 | Value: s45
153 | }
154 | SLRUnit
155 | {
156 | Key: ID
157 | Value: s14
158 | Key: LPAN
159 | Value: s15
160 | Key: NUMBER
161 | Value: s16
162 | Key: exp
163 | Value: 48
164 | Key: factor
165 | Value: 18
166 | Key: simple-exp
167 | Value: 19
168 | Key: term
169 | Value: 20
170 | }
171 | SLRUnit
172 | {
173 | Key: $
174 | Value: r(statement->write-stmt)
175 | Key: SEMI
176 | Value: r(statement->write-stmt)
177 | Key: else
178 | Value: r(statement->write-stmt)
179 | Key: end
180 | Value: r(statement->write-stmt)
181 | Key: until
182 | Value: r(statement->write-stmt)
183 | }
184 | SLRUnit
185 | {
186 | Key: ID
187 | Value: s14
188 | Key: LPAN
189 | Value: s15
190 | Key: NUMBER
191 | Value: s16
192 | Key: exp
193 | Value: 17
194 | Key: factor
195 | Value: 18
196 | Key: simple-exp
197 | Value: 19
198 | Key: term
199 | Value: 20
200 | }
201 | SLRUnit
202 | {
203 | Key: $
204 | Value: r(factor->ID)
205 | Key: DIVIDE
206 | Value: r(factor->ID)
207 | Key: EQ
208 | Value: r(factor->ID)
209 | Key: LT
210 | Value: r(factor->ID)
211 | Key: LTEQ
212 | Value: r(factor->ID)
213 | Key: MINUS
214 | Value: r(factor->ID)
215 | Key: MOD
216 | Value: r(factor->ID)
217 | Key: MULTIPLY
218 | Value: r(factor->ID)
219 | Key: NE
220 | Value: r(factor->ID)
221 | Key: PLUS
222 | Value: r(factor->ID)
223 | Key: RPAN
224 | Value: r(factor->ID)
225 | Key: RT
226 | Value: r(factor->ID)
227 | Key: RTEQ
228 | Value: r(factor->ID)
229 | Key: SEMI
230 | Value: r(factor->ID)
231 | Key: else
232 | Value: r(factor->ID)
233 | Key: end
234 | Value: r(factor->ID)
235 | Key: then
236 | Value: r(factor->ID)
237 | Key: until
238 | Value: r(factor->ID)
239 | }
240 | SLRUnit
241 | {
242 | Key: ID
243 | Value: s14
244 | Key: LPAN
245 | Value: s15
246 | Key: NUMBER
247 | Value: s16
248 | Key: exp
249 | Value: 21
250 | Key: factor
251 | Value: 18
252 | Key: simple-exp
253 | Value: 19
254 | Key: term
255 | Value: 20
256 | }
257 | SLRUnit
258 | {
259 | Key: $
260 | Value: r(factor->NUMBER)
261 | Key: DIVIDE
262 | Value: r(factor->NUMBER)
263 | Key: EQ
264 | Value: r(factor->NUMBER)
265 | Key: LT
266 | Value: r(factor->NUMBER)
267 | Key: LTEQ
268 | Value: r(factor->NUMBER)
269 | Key: MINUS
270 | Value: r(factor->NUMBER)
271 | Key: MOD
272 | Value: r(factor->NUMBER)
273 | Key: MULTIPLY
274 | Value: r(factor->NUMBER)
275 | Key: NE
276 | Value: r(factor->NUMBER)
277 | Key: PLUS
278 | Value: r(factor->NUMBER)
279 | Key: RPAN
280 | Value: r(factor->NUMBER)
281 | Key: RT
282 | Value: r(factor->NUMBER)
283 | Key: RTEQ
284 | Value: r(factor->NUMBER)
285 | Key: SEMI
286 | Value: r(factor->NUMBER)
287 | Key: else
288 | Value: r(factor->NUMBER)
289 | Key: end
290 | Value: r(factor->NUMBER)
291 | Key: then
292 | Value: r(factor->NUMBER)
293 | Key: until
294 | Value: r(factor->NUMBER)
295 | }
296 | SLRUnit
297 | {
298 | Key: $
299 | Value: r(assign-stmt->ID ASSIGN exp)
300 | Key: SEMI
301 | Value: r(assign-stmt->ID ASSIGN exp)
302 | Key: else
303 | Value: r(assign-stmt->ID ASSIGN exp)
304 | Key: end
305 | Value: r(assign-stmt->ID ASSIGN exp)
306 | Key: until
307 | Value: r(assign-stmt->ID ASSIGN exp)
308 | }
309 | SLRUnit
310 | {
311 | Key: $
312 | Value: r(term->factor)
313 | Key: DIVIDE
314 | Value: r(term->factor)
315 | Key: EQ
316 | Value: r(term->factor)
317 | Key: LT
318 | Value: r(term->factor)
319 | Key: LTEQ
320 | Value: r(term->factor)
321 | Key: MINUS
322 | Value: r(term->factor)
323 | Key: MOD
324 | Value: r(term->factor)
325 | Key: MULTIPLY
326 | Value: r(term->factor)
327 | Key: NE
328 | Value: r(term->factor)
329 | Key: PLUS
330 | Value: r(term->factor)
331 | Key: RPAN
332 | Value: r(term->factor)
333 | Key: RT
334 | Value: r(term->factor)
335 | Key: RTEQ
336 | Value: r(term->factor)
337 | Key: SEMI
338 | Value: r(term->factor)
339 | Key: else
340 | Value: r(term->factor)
341 | Key: end
342 | Value: r(term->factor)
343 | Key: then
344 | Value: r(term->factor)
345 | Key: until
346 | Value: r(term->factor)
347 | }
348 | SLRUnit
349 | {
350 | Key: $
351 | Value: r(exp->simple-exp)
352 | Key: EQ
353 | Value: s23
354 | Key: LT
355 | Value: s24
356 | Key: LTEQ
357 | Value: s25
358 | Key: MINUS
359 | Value: s26
360 | Key: NE
361 | Value: s27
362 | Key: PLUS
363 | Value: s28
364 | Key: RPAN
365 | Value: r(exp->simple-exp)
366 | Key: RT
367 | Value: s29
368 | Key: RTEQ
369 | Value: s30
370 | Key: SEMI
371 | Value: r(exp->simple-exp)
372 | Key: addop
373 | Value: 31
374 | Key: comparison-op
375 | Value: 32
376 | Key: else
377 | Value: r(exp->simple-exp)
378 | Key: end
379 | Value: r(exp->simple-exp)
380 | Key: then
381 | Value: r(exp->simple-exp)
382 | Key: until
383 | Value: r(exp->simple-exp)
384 | }
385 | SLRUnit
386 | {
387 | Key: $
388 | Value: r(simple-exp->term)
389 | Key: DIVIDE
390 | Value: s34
391 | Key: EQ
392 | Value: r(simple-exp->term)
393 | Key: LT
394 | Value: r(simple-exp->term)
395 | Key: LTEQ
396 | Value: r(simple-exp->term)
397 | Key: MINUS
398 | Value: r(simple-exp->term)
399 | Key: MOD
400 | Value: s35
401 | Key: MULTIPLY
402 | Value: s36
403 | Key: NE
404 | Value: r(simple-exp->term)
405 | Key: PLUS
406 | Value: r(simple-exp->term)
407 | Key: RPAN
408 | Value: r(simple-exp->term)
409 | Key: RT
410 | Value: r(simple-exp->term)
411 | Key: RTEQ
412 | Value: r(simple-exp->term)
413 | Key: SEMI
414 | Value: r(simple-exp->term)
415 | Key: else
416 | Value: r(simple-exp->term)
417 | Key: end
418 | Value: r(simple-exp->term)
419 | Key: mulop
420 | Value: 37
421 | Key: then
422 | Value: r(simple-exp->term)
423 | Key: until
424 | Value: r(simple-exp->term)
425 | }
426 | SLRUnit
427 | {
428 | Key: RPAN
429 | Value: s22
430 | }
431 | SLRUnit
432 | {
433 | Key: $
434 | Value: r(factor->LPAN exp RPAN)
435 | Key: DIVIDE
436 | Value: r(factor->LPAN exp RPAN)
437 | Key: EQ
438 | Value: r(factor->LPAN exp RPAN)
439 | Key: LT
440 | Value: r(factor->LPAN exp RPAN)
441 | Key: LTEQ
442 | Value: r(factor->LPAN exp RPAN)
443 | Key: MINUS
444 | Value: r(factor->LPAN exp RPAN)
445 | Key: MOD
446 | Value: r(factor->LPAN exp RPAN)
447 | Key: MULTIPLY
448 | Value: r(factor->LPAN exp RPAN)
449 | Key: NE
450 | Value: r(factor->LPAN exp RPAN)
451 | Key: PLUS
452 | Value: r(factor->LPAN exp RPAN)
453 | Key: RPAN
454 | Value: r(factor->LPAN exp RPAN)
455 | Key: RT
456 | Value: r(factor->LPAN exp RPAN)
457 | Key: RTEQ
458 | Value: r(factor->LPAN exp RPAN)
459 | Key: SEMI
460 | Value: r(factor->LPAN exp RPAN)
461 | Key: else
462 | Value: r(factor->LPAN exp RPAN)
463 | Key: end
464 | Value: r(factor->LPAN exp RPAN)
465 | Key: then
466 | Value: r(factor->LPAN exp RPAN)
467 | Key: until
468 | Value: r(factor->LPAN exp RPAN)
469 | }
470 | SLRUnit
471 | {
472 | Key: ID
473 | Value: r(comparison-op->EQ)
474 | Key: LPAN
475 | Value: r(comparison-op->EQ)
476 | Key: NUMBER
477 | Value: r(comparison-op->EQ)
478 | }
479 | SLRUnit
480 | {
481 | Key: ID
482 | Value: r(comparison-op->LT)
483 | Key: LPAN
484 | Value: r(comparison-op->LT)
485 | Key: NUMBER
486 | Value: r(comparison-op->LT)
487 | }
488 | SLRUnit
489 | {
490 | Key: ID
491 | Value: r(comparison-op->LTEQ)
492 | Key: LPAN
493 | Value: r(comparison-op->LTEQ)
494 | Key: NUMBER
495 | Value: r(comparison-op->LTEQ)
496 | }
497 | SLRUnit
498 | {
499 | Key: ID
500 | Value: r(addop->MINUS)
501 | Key: LPAN
502 | Value: r(addop->MINUS)
503 | Key: NUMBER
504 | Value: r(addop->MINUS)
505 | }
506 | SLRUnit
507 | {
508 | Key: ID
509 | Value: r(comparison-op->NE)
510 | Key: LPAN
511 | Value: r(comparison-op->NE)
512 | Key: NUMBER
513 | Value: r(comparison-op->NE)
514 | }
515 | SLRUnit
516 | {
517 | Key: ID
518 | Value: r(addop->PLUS)
519 | Key: LPAN
520 | Value: r(addop->PLUS)
521 | Key: NUMBER
522 | Value: r(addop->PLUS)
523 | }
524 | SLRUnit
525 | {
526 | Key: ID
527 | Value: r(comparison-op->RT)
528 | Key: LPAN
529 | Value: r(comparison-op->RT)
530 | Key: NUMBER
531 | Value: r(comparison-op->RT)
532 | }
533 | SLRUnit
534 | {
535 | Key: ID
536 | Value: r(comparison-op->RTEQ)
537 | Key: LPAN
538 | Value: r(comparison-op->RTEQ)
539 | Key: NUMBER
540 | Value: r(comparison-op->RTEQ)
541 | }
542 | SLRUnit
543 | {
544 | Key: ID
545 | Value: s14
546 | Key: LPAN
547 | Value: s15
548 | Key: NUMBER
549 | Value: s16
550 | Key: factor
551 | Value: 18
552 | Key: term
553 | Value: 33
554 | }
555 | SLRUnit
556 | {
557 | Key: ID
558 | Value: s14
559 | Key: LPAN
560 | Value: s15
561 | Key: NUMBER
562 | Value: s16
563 | Key: factor
564 | Value: 18
565 | Key: simple-exp
566 | Value: 39
567 | Key: term
568 | Value: 20
569 | }
570 | SLRUnit
571 | {
572 | Key: $
573 | Value: r(simple-exp->simple-exp addop term)
574 | Key: DIVIDE
575 | Value: s34
576 | Key: EQ
577 | Value: r(simple-exp->simple-exp addop term)
578 | Key: LT
579 | Value: r(simple-exp->simple-exp addop term)
580 | Key: LTEQ
581 | Value: r(simple-exp->simple-exp addop term)
582 | Key: MINUS
583 | Value: r(simple-exp->simple-exp addop term)
584 | Key: MOD
585 | Value: s35
586 | Key: MULTIPLY
587 | Value: s36
588 | Key: NE
589 | Value: r(simple-exp->simple-exp addop term)
590 | Key: PLUS
591 | Value: r(simple-exp->simple-exp addop term)
592 | Key: RPAN
593 | Value: r(simple-exp->simple-exp addop term)
594 | Key: RT
595 | Value: r(simple-exp->simple-exp addop term)
596 | Key: RTEQ
597 | Value: r(simple-exp->simple-exp addop term)
598 | Key: SEMI
599 | Value: r(simple-exp->simple-exp addop term)
600 | Key: else
601 | Value: r(simple-exp->simple-exp addop term)
602 | Key: end
603 | Value: r(simple-exp->simple-exp addop term)
604 | Key: mulop
605 | Value: 37
606 | Key: then
607 | Value: r(simple-exp->simple-exp addop term)
608 | Key: until
609 | Value: r(simple-exp->simple-exp addop term)
610 | }
611 | SLRUnit
612 | {
613 | Key: ID
614 | Value: r(mulop->DIVIDE)
615 | Key: LPAN
616 | Value: r(mulop->DIVIDE)
617 | Key: NUMBER
618 | Value: r(mulop->DIVIDE)
619 | }
620 | SLRUnit
621 | {
622 | Key: ID
623 | Value: r(mulop->MOD)
624 | Key: LPAN
625 | Value: r(mulop->MOD)
626 | Key: NUMBER
627 | Value: r(mulop->MOD)
628 | }
629 | SLRUnit
630 | {
631 | Key: ID
632 | Value: r(mulop->MULTIPLY)
633 | Key: LPAN
634 | Value: r(mulop->MULTIPLY)
635 | Key: NUMBER
636 | Value: r(mulop->MULTIPLY)
637 | }
638 | SLRUnit
639 | {
640 | Key: ID
641 | Value: s14
642 | Key: LPAN
643 | Value: s15
644 | Key: NUMBER
645 | Value: s16
646 | Key: factor
647 | Value: 38
648 | }
649 | SLRUnit
650 | {
651 | Key: $
652 | Value: r(term->term mulop factor)
653 | Key: DIVIDE
654 | Value: r(term->term mulop factor)
655 | Key: EQ
656 | Value: r(term->term mulop factor)
657 | Key: LT
658 | Value: r(term->term mulop factor)
659 | Key: LTEQ
660 | Value: r(term->term mulop factor)
661 | Key: MINUS
662 | Value: r(term->term mulop factor)
663 | Key: MOD
664 | Value: r(term->term mulop factor)
665 | Key: MULTIPLY
666 | Value: r(term->term mulop factor)
667 | Key: NE
668 | Value: r(term->term mulop factor)
669 | Key: PLUS
670 | Value: r(term->term mulop factor)
671 | Key: RPAN
672 | Value: r(term->term mulop factor)
673 | Key: RT
674 | Value: r(term->term mulop factor)
675 | Key: RTEQ
676 | Value: r(term->term mulop factor)
677 | Key: SEMI
678 | Value: r(term->term mulop factor)
679 | Key: else
680 | Value: r(term->term mulop factor)
681 | Key: end
682 | Value: r(term->term mulop factor)
683 | Key: then
684 | Value: r(term->term mulop factor)
685 | Key: until
686 | Value: r(term->term mulop factor)
687 | }
688 | SLRUnit
689 | {
690 | Key: $
691 | Value: r(exp->simple-exp comparison-op simple-exp)
692 | Key: MINUS
693 | Value: s26
694 | Key: PLUS
695 | Value: s28
696 | Key: RPAN
697 | Value: r(exp->simple-exp comparison-op simple-exp)
698 | Key: SEMI
699 | Value: r(exp->simple-exp comparison-op simple-exp)
700 | Key: addop
701 | Value: 31
702 | Key: else
703 | Value: r(exp->simple-exp comparison-op simple-exp)
704 | Key: end
705 | Value: r(exp->simple-exp comparison-op simple-exp)
706 | Key: then
707 | Value: r(exp->simple-exp comparison-op simple-exp)
708 | Key: until
709 | Value: r(exp->simple-exp comparison-op simple-exp)
710 | }
711 | SLRUnit
712 | {
713 | Key: then
714 | Value: s41
715 | }
716 | SLRUnit
717 | {
718 | Key: ID
719 | Value: s1
720 | Key: assign-stmt
721 | Value: 2
722 | Key: if
723 | Value: s3
724 | Key: if-stmt
725 | Value: 4
726 | Key: read
727 | Value: s5
728 | Key: read-stmt
729 | Value: 6
730 | Key: repeat
731 | Value: s7
732 | Key: repeat-stmt
733 | Value: 8
734 | Key: statement
735 | Value: 9
736 | Key: stmt-sequence
737 | Value: 42
738 | Key: write
739 | Value: s11
740 | Key: write-stmt
741 | Value: 12
742 | }
743 | SLRUnit
744 | {
745 | Key: SEMI
746 | Value: s45
747 | Key: else
748 | Value: s50
749 | Key: end
750 | Value: s51
751 | }
752 | SLRUnit
753 | {
754 | Key: $
755 | Value: r(read-stmt->read ID)
756 | Key: SEMI
757 | Value: r(read-stmt->read ID)
758 | Key: else
759 | Value: r(read-stmt->read ID)
760 | Key: end
761 | Value: r(read-stmt->read ID)
762 | Key: until
763 | Value: r(read-stmt->read ID)
764 | }
765 | SLRUnit
766 | {
767 | Key: SEMI
768 | Value: s45
769 | Key: until
770 | Value: s46
771 | }
772 | SLRUnit
773 | {
774 | Key: ID
775 | Value: s1
776 | Key: assign-stmt
777 | Value: 2
778 | Key: if
779 | Value: s3
780 | Key: if-stmt
781 | Value: 4
782 | Key: read
783 | Value: s5
784 | Key: read-stmt
785 | Value: 6
786 | Key: repeat
787 | Value: s7
788 | Key: repeat-stmt
789 | Value: 8
790 | Key: statement
791 | Value: 47
792 | Key: write
793 | Value: s11
794 | Key: write-stmt
795 | Value: 12
796 | }
797 | SLRUnit
798 | {
799 | Key: ID
800 | Value: s14
801 | Key: LPAN
802 | Value: s15
803 | Key: NUMBER
804 | Value: s16
805 | Key: exp
806 | Value: 49
807 | Key: factor
808 | Value: 18
809 | Key: simple-exp
810 | Value: 19
811 | Key: term
812 | Value: 20
813 | }
814 | SLRUnit
815 | {
816 | Key: $
817 | Value: r(stmt-sequence->stmt-sequence SEMI statement)
818 | Key: SEMI
819 | Value: r(stmt-sequence->stmt-sequence SEMI statement)
820 | Key: else
821 | Value: r(stmt-sequence->stmt-sequence SEMI statement)
822 | Key: end
823 | Value: r(stmt-sequence->stmt-sequence SEMI statement)
824 | Key: until
825 | Value: r(stmt-sequence->stmt-sequence SEMI statement)
826 | }
827 | SLRUnit
828 | {
829 | Key: $
830 | Value: r(write-stmt->write exp)
831 | Key: SEMI
832 | Value: r(write-stmt->write exp)
833 | Key: else
834 | Value: r(write-stmt->write exp)
835 | Key: end
836 | Value: r(write-stmt->write exp)
837 | Key: until
838 | Value: r(write-stmt->write exp)
839 | }
840 | SLRUnit
841 | {
842 | Key: $
843 | Value: r(repeat-stmt->repeat stmt-sequence until exp)
844 | Key: SEMI
845 | Value: r(repeat-stmt->repeat stmt-sequence until exp)
846 | Key: else
847 | Value: r(repeat-stmt->repeat stmt-sequence until exp)
848 | Key: end
849 | Value: r(repeat-stmt->repeat stmt-sequence until exp)
850 | Key: until
851 | Value: r(repeat-stmt->repeat stmt-sequence until exp)
852 | }
853 | SLRUnit
854 | {
855 | Key: ID
856 | Value: s1
857 | Key: assign-stmt
858 | Value: 2
859 | Key: if
860 | Value: s3
861 | Key: if-stmt
862 | Value: 4
863 | Key: read
864 | Value: s5
865 | Key: read-stmt
866 | Value: 6
867 | Key: repeat
868 | Value: s7
869 | Key: repeat-stmt
870 | Value: 8
871 | Key: statement
872 | Value: 9
873 | Key: stmt-sequence
874 | Value: 52
875 | Key: write
876 | Value: s11
877 | Key: write-stmt
878 | Value: 12
879 | }
880 | SLRUnit
881 | {
882 | Key: $
883 | Value: r(if-stmt->if exp then stmt-sequence end)
884 | Key: SEMI
885 | Value: r(if-stmt->if exp then stmt-sequence end)
886 | Key: else
887 | Value: r(if-stmt->if exp then stmt-sequence end)
888 | Key: end
889 | Value: r(if-stmt->if exp then stmt-sequence end)
890 | Key: until
891 | Value: r(if-stmt->if exp then stmt-sequence end)
892 | }
893 | SLRUnit
894 | {
895 | Key: SEMI
896 | Value: s45
897 | Key: end
898 | Value: s53
899 | }
900 | SLRUnit
901 | {
902 | Key: $
903 | Value: r(if-stmt->if exp then stmt-sequence else stmt-sequence end)
904 | Key: SEMI
905 | Value: r(if-stmt->if exp then stmt-sequence else stmt-sequence end)
906 | Key: else
907 | Value: r(if-stmt->if exp then stmt-sequence else stmt-sequence end)
908 | Key: end
909 | Value: r(if-stmt->if exp then stmt-sequence else stmt-sequence end)
910 | Key: until
911 | Value: r(if-stmt->if exp then stmt-sequence else stmt-sequence end)
912 | }
913 |
--------------------------------------------------------------------------------
/test/2. 任务二测试文本及程序/2. 程序生成文件/output.lex:
--------------------------------------------------------------------------------
1 | read:read
2 | ID:xXx
3 | SEMI:;
4 | if:if
5 | LPAN:(
6 | ID:xXx
7 | LT:<
8 | ID:yYy
9 | RPAN:)
10 | then:then
11 | repeat:repeat
12 | ID:xXx
13 | ASSIGN::=
14 | LPAN:(
15 | ID:xXx
16 | PLUS:+
17 | NUMBER:1
18 | RPAN:)
19 | MULTIPLY:*
20 | NUMBER:1
21 | MINUS:-
22 | NUMBER:0
23 | DIVIDE:/
24 | NUMBER:1
25 | until:until
26 | ID:xXx
27 | EQ:=
28 | ID:yYy
29 | else:else
30 | write:write
31 | NUMBER:001
32 | PLUS:+
33 | NUMBER:123
34 | MOD:%
35 | NUMBER:2
36 | end:end
37 | SEMI:;
38 | read:read
39 | ID:z1
40 | SEMI:;
41 | if:if
42 | ID:z1
43 | LTEQ:<=
44 | NUMBER:1000
45 | then:then
46 | ID:z1
47 | ASSIGN::=
48 | NUMBER:0
49 | else:else
50 | ID:z1
51 | ASSIGN::=
52 | NUMBER:1
53 | end:end
54 | SEMI:;
55 | if:if
56 | ID:z1
57 | NE:<>
58 | NUMBER:1000
59 | then:then
60 | ID:z1
61 | ASSIGN::=
62 | NUMBER:0
63 | else:else
64 | ID:z1
65 | ASSIGN::=
66 | NUMBER:1
67 | end:end
68 | SEMI:;
69 | if:if
70 | ID:z1
71 | RTEQ:>=
72 | NUMBER:1000
73 | then:then
74 | ID:z1
75 | ASSIGN::=
76 | NUMBER:0
77 | else:else
78 | ID:z1
79 | ASSIGN::=
80 | NUMBER:1
81 | end:end
82 | SEMI:;
83 | if:if
84 | ID:z1
85 | RT:>
86 | NUMBER:1000
87 | then:then
88 | ID:z1
89 | ASSIGN::=
90 | NUMBER:0
91 | else:else
92 | ID:z1
93 | ASSIGN::=
94 | NUMBER:1
95 | end:end
96 | EOF:EOF
--------------------------------------------------------------------------------
/test/2. 任务二测试文本及程序/2. 程序生成文件/tree.out:
--------------------------------------------------------------------------------
1 | BTreeNode
2 | {
3 | kind: -1
4 | value: stmt-sequence
5 | nodeList:
6 | BTreeNode
7 | {
8 | kind: -1
9 | value: stmt-sequence
10 | nodeList:
11 | BTreeNode
12 | {
13 | kind: -1
14 | value: stmt-sequence
15 | nodeList:
16 | BTreeNode
17 | {
18 | kind: -1
19 | value: stmt-sequence
20 | nodeList:
21 | BTreeNode
22 | {
23 | kind: -1
24 | value: stmt-sequence
25 | nodeList:
26 | BTreeNode
27 | {
28 | kind: -1
29 | value: stmt-sequence
30 | nodeList:
31 | BTreeNode
32 | {
33 | kind: read
34 | value: read
35 | nodeList:
36 | BTreeNode
37 | {
38 | kind: ID
39 | value: xXx
40 | }
41 | }
42 | BTreeNode
43 | {
44 | kind: if
45 | value: if
46 | nodeList:
47 | BTreeNode
48 | {
49 | kind: LT
50 | value: <
51 | nodeList:
52 | BTreeNode
53 | {
54 | kind: ID
55 | value: xXx
56 | }
57 | BTreeNode
58 | {
59 | kind: ID
60 | value: yYy
61 | }
62 | }
63 | BTreeNode
64 | {
65 | kind: repeat
66 | value: repeat
67 | nodeList:
68 | BTreeNode
69 | {
70 | kind: ASSIGN
71 | value: :=
72 | nodeList:
73 | BTreeNode
74 | {
75 | kind: ID
76 | value: xXx
77 | }
78 | BTreeNode
79 | {
80 | kind: -1
81 | value: simple-exp
82 | nodeList:
83 | BTreeNode
84 | {
85 | kind: MINUS
86 | value: -
87 | }
88 | BTreeNode
89 | {
90 | kind: -1
91 | value: term
92 | nodeList:
93 | BTreeNode
94 | {
95 | kind: MULTIPLY
96 | value: *
97 | }
98 | BTreeNode
99 | {
100 | kind: -1
101 | value: simple-exp
102 | nodeList:
103 | BTreeNode
104 | {
105 | kind: PLUS
106 | value: +
107 | }
108 | BTreeNode
109 | {
110 | kind: ID
111 | value: xXx
112 | }
113 | BTreeNode
114 | {
115 | kind: NUMBER
116 | value: 1
117 | }
118 | }
119 | BTreeNode
120 | {
121 | kind: NUMBER
122 | value: 1
123 | }
124 | }
125 | BTreeNode
126 | {
127 | kind: -1
128 | value: term
129 | nodeList:
130 | BTreeNode
131 | {
132 | kind: DIVIDE
133 | value: /
134 | }
135 | BTreeNode
136 | {
137 | kind: NUMBER
138 | value: 0
139 | }
140 | BTreeNode
141 | {
142 | kind: NUMBER
143 | value: 1
144 | }
145 | }
146 | }
147 | }
148 | BTreeNode
149 | {
150 | kind: EQ
151 | value: =
152 | nodeList:
153 | BTreeNode
154 | {
155 | kind: ID
156 | value: xXx
157 | }
158 | BTreeNode
159 | {
160 | kind: ID
161 | value: yYy
162 | }
163 | }
164 | }
165 | BTreeNode
166 | {
167 | kind: write
168 | value: write
169 | nodeList:
170 | BTreeNode
171 | {
172 | kind: -1
173 | value: simple-exp
174 | nodeList:
175 | BTreeNode
176 | {
177 | kind: PLUS
178 | value: +
179 | }
180 | BTreeNode
181 | {
182 | kind: NUMBER
183 | value: 001
184 | }
185 | BTreeNode
186 | {
187 | kind: -1
188 | value: term
189 | nodeList:
190 | BTreeNode
191 | {
192 | kind: MOD
193 | value: %
194 | }
195 | BTreeNode
196 | {
197 | kind: NUMBER
198 | value: 123
199 | }
200 | BTreeNode
201 | {
202 | kind: NUMBER
203 | value: 2
204 | }
205 | }
206 | }
207 | }
208 | }
209 | }
210 | BTreeNode
211 | {
212 | kind: read
213 | value: read
214 | nodeList:
215 | BTreeNode
216 | {
217 | kind: ID
218 | value: z1
219 | }
220 | }
221 | }
222 | BTreeNode
223 | {
224 | kind: if
225 | value: if
226 | nodeList:
227 | BTreeNode
228 | {
229 | kind: LTEQ
230 | value: <=
231 | nodeList:
232 | BTreeNode
233 | {
234 | kind: ID
235 | value: z1
236 | }
237 | BTreeNode
238 | {
239 | kind: NUMBER
240 | value: 1000
241 | }
242 | }
243 | BTreeNode
244 | {
245 | kind: ASSIGN
246 | value: :=
247 | nodeList:
248 | BTreeNode
249 | {
250 | kind: ID
251 | value: z1
252 | }
253 | BTreeNode
254 | {
255 | kind: NUMBER
256 | value: 0
257 | }
258 | }
259 | BTreeNode
260 | {
261 | kind: ASSIGN
262 | value: :=
263 | nodeList:
264 | BTreeNode
265 | {
266 | kind: ID
267 | value: z1
268 | }
269 | BTreeNode
270 | {
271 | kind: NUMBER
272 | value: 1
273 | }
274 | }
275 | }
276 | }
277 | BTreeNode
278 | {
279 | kind: if
280 | value: if
281 | nodeList:
282 | BTreeNode
283 | {
284 | kind: NE
285 | value: <>
286 | nodeList:
287 | BTreeNode
288 | {
289 | kind: ID
290 | value: z1
291 | }
292 | BTreeNode
293 | {
294 | kind: NUMBER
295 | value: 1000
296 | }
297 | }
298 | BTreeNode
299 | {
300 | kind: ASSIGN
301 | value: :=
302 | nodeList:
303 | BTreeNode
304 | {
305 | kind: ID
306 | value: z1
307 | }
308 | BTreeNode
309 | {
310 | kind: NUMBER
311 | value: 0
312 | }
313 | }
314 | BTreeNode
315 | {
316 | kind: ASSIGN
317 | value: :=
318 | nodeList:
319 | BTreeNode
320 | {
321 | kind: ID
322 | value: z1
323 | }
324 | BTreeNode
325 | {
326 | kind: NUMBER
327 | value: 1
328 | }
329 | }
330 | }
331 | }
332 | BTreeNode
333 | {
334 | kind: if
335 | value: if
336 | nodeList:
337 | BTreeNode
338 | {
339 | kind: RTEQ
340 | value: >=
341 | nodeList:
342 | BTreeNode
343 | {
344 | kind: ID
345 | value: z1
346 | }
347 | BTreeNode
348 | {
349 | kind: NUMBER
350 | value: 1000
351 | }
352 | }
353 | BTreeNode
354 | {
355 | kind: ASSIGN
356 | value: :=
357 | nodeList:
358 | BTreeNode
359 | {
360 | kind: ID
361 | value: z1
362 | }
363 | BTreeNode
364 | {
365 | kind: NUMBER
366 | value: 0
367 | }
368 | }
369 | BTreeNode
370 | {
371 | kind: ASSIGN
372 | value: :=
373 | nodeList:
374 | BTreeNode
375 | {
376 | kind: ID
377 | value: z1
378 | }
379 | BTreeNode
380 | {
381 | kind: NUMBER
382 | value: 1
383 | }
384 | }
385 | }
386 | }
387 | BTreeNode
388 | {
389 | kind: if
390 | value: if
391 | nodeList:
392 | BTreeNode
393 | {
394 | kind: RT
395 | value: >
396 | nodeList:
397 | BTreeNode
398 | {
399 | kind: ID
400 | value: z1
401 | }
402 | BTreeNode
403 | {
404 | kind: NUMBER
405 | value: 1000
406 | }
407 | }
408 | BTreeNode
409 | {
410 | kind: ASSIGN
411 | value: :=
412 | nodeList:
413 | BTreeNode
414 | {
415 | kind: ID
416 | value: z1
417 | }
418 | BTreeNode
419 | {
420 | kind: NUMBER
421 | value: 0
422 | }
423 | }
424 | BTreeNode
425 | {
426 | kind: ASSIGN
427 | value: :=
428 | nodeList:
429 | BTreeNode
430 | {
431 | kind: ID
432 | value: z1
433 | }
434 | BTreeNode
435 | {
436 | kind: NUMBER
437 | value: 1
438 | }
439 | }
440 | }
441 | }
442 |
--------------------------------------------------------------------------------
/test/2. 任务二测试文本及程序/2. 程序生成文件/treeCode.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/2. 任务二测试文本及程序/2. 程序生成文件/treeCode.cpp
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务1/1. 测试文本/minic正则表达式.txt:
--------------------------------------------------------------------------------
1 | else|if|int|float|double|return|void|do|while
2 | \+\ | - | \*\ | / | % | < | <= | >= | > | ==| != | = | ; | , | \(\ | \)\ | \[\ | \]\ | { | }
3 | PLUS | MINUS | MULTIPLY | DIVIDE | MOD | LT| LTEQ | RTEQ | RT | EQ | NE | ASSIGN | SEMI | DOU | LLM | RLM | LMM | RMM | LBM | RBM
4 | (_|letter)(_|letter|num)*
5 | num num* (.num num *)?
6 | //~\n
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务1/1. 测试文本/示例程序.txt:
--------------------------------------------------------------------------------
1 | //Sample program
2 | //In MiniC language-computes factorial
3 | //}
4 | int x; // an integer
5 | int fact;
6 | double y;
7 | int arr[100];
8 | void test(int a, int b)
9 | {
10 | a = 1;
11 | b = 2;
12 | return ;
13 | }
14 | void main(void)
15 | {
16 | x = 2;
17 | y = 3;
18 | if ( x > 1 ) //don't compute if x <= 0
19 | do
20 | fact = fact * x;
21 | while (fact >= 1);
22 | else
23 | x = 1;
24 | return ; //return void
25 | }
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务1/2. 程序生成文件/_lexer.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/3. 任务三测试文本及程序/项目任务1/2. 程序生成文件/_lexer.c
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务1/2. 程序生成文件/_lexer.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/3. 任务三测试文本及程序/项目任务1/2. 程序生成文件/_lexer.exe
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务1/2. 程序生成文件/_sample.tny:
--------------------------------------------------------------------------------
1 | //Sample program
2 | //In MiniC language-computes factorial
3 | //}
4 | int x; // an integer
5 | int fact;
6 | double y;
7 | int arr[100];
8 | void test(int a, int b)
9 | {
10 | a = 1;
11 | b = 2;
12 | return ;
13 | }
14 | void main(void)
15 | {
16 | x = 2;
17 | y = 3;
18 | if ( x > 1 ) //don't compute if x <= 0
19 | do
20 | fact = fact * x;
21 | while (fact >= 1);
22 | else
23 | x = 1;
24 | return ; //return void
25 | }
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务1/2. 程序生成文件/output.lex:
--------------------------------------------------------------------------------
1 | int:int
2 | ID:x
3 | SEMI:;
4 | int:int
5 | ID:fact
6 | SEMI:;
7 | double:double
8 | ID:y
9 | SEMI:;
10 | int:int
11 | ID:arr
12 | LMM:[
13 | NUMBER:100
14 | RMM:]
15 | SEMI:;
16 | void:void
17 | ID:test
18 | LLM:(
19 | int:int
20 | ID:a
21 | DOU:,
22 | int:int
23 | ID:b
24 | RLM:)
25 | LBM:{
26 | ID:a
27 | ASSIGN:=
28 | NUMBER:1
29 | SEMI:;
30 | ID:b
31 | ASSIGN:=
32 | NUMBER:2
33 | SEMI:;
34 | return:return
35 | SEMI:;
36 | RBM:}
37 | void:void
38 | ID:main
39 | LLM:(
40 | void:void
41 | RLM:)
42 | LBM:{
43 | ID:x
44 | ASSIGN:=
45 | NUMBER:2
46 | SEMI:;
47 | ID:y
48 | ASSIGN:=
49 | NUMBER:3
50 | SEMI:;
51 | if:if
52 | LLM:(
53 | ID:x
54 | RT:>
55 | NUMBER:1
56 | RLM:)
57 | do:do
58 | ID:fact
59 | ASSIGN:=
60 | ID:fact
61 | MULTIPLY:*
62 | ID:x
63 | SEMI:;
64 | while:while
65 | LLM:(
66 | ID:fact
67 | RTEQ:>=
68 | NUMBER:1
69 | RLM:)
70 | SEMI:;
71 | else:else
72 | ID:x
73 | ASSIGN:=
74 | NUMBER:1
75 | SEMI:;
76 | return:return
77 | SEMI:;
78 | RBM:}
79 | EOF:EOF
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务2/1. 测试文本/文法.txt:
--------------------------------------------------------------------------------
1 | program | definition-list | definition | variable-definition | function-definition | type-indicator | parameters | compound-stmt | parameter-list | parameter | local-definitions | statement-list | statement | expression-stmt | condition-stmt | dowhile-stmt | return-stmt | expression | simple-expression | variable | additive-expression | relop | term | addop | mulop | factor | call | arguments | argument-list
2 | ID | SEMI | LMM | RMM | int | float | double | void | LLM | RLM | if | else | do | while | return | LTEQ | LT | RT | RTEQ | EQ | NE | PLUS | MINUS | MULTIPLY | DIVIDE | MOD | NUMBER | DOU | LBM | RBM | ASSIGN
3 | program -> definition-list
4 | definition-list -> definition-list definition
5 | definition-list -> definition
6 | definition -> variable-definition
7 | definition -> function-definition
8 | variable-definition -> type-indicator ID SEMI
9 | variable-definition -> type-indicator ID LMM NUMBER RMM SEMI
10 | type-indicator -> int
11 | type-indicator -> float
12 | type-indicator -> double
13 | type-indicator -> void
14 | function-definition -> type-indicator ID LLM parameters RLM compound-stmt
15 | parameters -> parameter-list
16 | parameters -> void
17 | parameter-list -> parameter-list DOU parameter
18 | parameter-list -> parameter
19 | parameter -> type-indicator ID
20 | parameter -> type-indicator ID LMM RMM
21 | compound-stmt -> LBM local-definitions statement-list RBM
22 | local-definitions -> local-definitions variable-definition
23 | local-definitions -> @
24 | statement-list -> statement-list statement
25 | statement-list -> @
26 | statement -> expression-stmt
27 | statement -> compound-stmt
28 | statement -> condition-stmt
29 | statement -> dowhile-stmt
30 | statement -> return-stmt
31 | expression-stmt -> expression SEMI
32 | expression-stmt -> SEMI
33 | condition-stmt -> if LLM expression RLM statement
34 | condition-stmt -> if LLM expression RLM statement else statement
35 | dowhile-stmt -> do statement while LLM expression RLM SEMI
36 | return-stmt -> return SEMI
37 | return-stmt -> return expression SEMI
38 | expression -> variable ASSIGN expression
39 | expression -> simple-expression
40 | variable -> ID
41 | variable -> ID LMM expression RMM
42 | simple-expression -> additive-expression relop additive-expression
43 | simple-expression -> additive-expression
44 | relop -> LTEQ
45 | relop -> LT
46 | relop -> RT
47 | relop -> RTEQ
48 | relop -> EQ
49 | relop -> NE
50 | additive-expression -> additive-expression addop term
51 | additive-expression -> term
52 | addop -> PLUS
53 | addop -> MINUS
54 | term -> term mulop factor
55 | term -> factor
56 | mulop -> MULTIPLY
57 | mulop -> DIVIDE
58 | mulop -> MOD
59 | factor -> LLM expression RLM
60 | factor -> variable
61 | factor -> call
62 | factor -> NUMBER
63 | call -> ID LLM arguments RLM
64 | arguments -> argument-list
65 | arguments -> @
66 | argument-list -> argument-list DOU expression
67 | argument-list -> expression
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务2/1. 测试文本/语义函数.txt:
--------------------------------------------------------------------------------
1 | 0
2 | 0 1
3 | 0
4 | 0
5 | 0
6 | 1 0 -1
7 | 1 0 -1 2 -1 -1
8 | 0
9 | 0
10 | 0
11 | 0
12 | 1 0 -1 2 -1 3
13 | 0
14 | 0
15 | 0 -1 1
16 | 0
17 | 1 0
18 | 1 0 -1 -1
19 | -1 0 1 -1
20 | 0 1
21 | -1
22 | 0 1
23 | -1
24 | 0
25 | 0
26 | 0
27 | 0
28 | 0
29 | 0 -1
30 | -1
31 | 0 -1 1 -1 2
32 | 0 -1 1 -1 2 -1 3
33 | 0 1 -1 -1 2 -1 -1
34 | 0 -1
35 | 0 1 -1
36 | 1 0 2
37 | 0
38 | 0
39 | 0 -1 1 -1
40 | 1 0 2
41 | 0
42 | 0
43 | 0
44 | 0
45 | 0
46 | 0
47 | 0
48 | 0 1 2
49 | 0
50 | 0
51 | 0
52 | 0 1 2
53 | 0
54 | 0
55 | 0
56 | 0
57 | -1 0 -1
58 | 0
59 | 0
60 | 0
61 | 0 -1 1 -1
62 | 0
63 | -1
64 | 0 -1 1
65 | 0
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务2/2. 测试生成的程序/output.lex:
--------------------------------------------------------------------------------
1 | int:int
2 | ID:x
3 | SEMI:;
4 | int:int
5 | ID:fact
6 | SEMI:;
7 | double:double
8 | ID:y
9 | SEMI:;
10 | int:int
11 | ID:arr
12 | LMM:[
13 | NUMBER:100
14 | RMM:]
15 | SEMI:;
16 | void:void
17 | ID:test
18 | LLM:(
19 | int:int
20 | ID:a
21 | DOU:,
22 | int:int
23 | ID:b
24 | RLM:)
25 | LBM:{
26 | ID:a
27 | ASSIGN:=
28 | NUMBER:1
29 | SEMI:;
30 | ID:b
31 | ASSIGN:=
32 | NUMBER:2
33 | SEMI:;
34 | return:return
35 | SEMI:;
36 | RBM:}
37 | void:void
38 | ID:main
39 | LLM:(
40 | void:void
41 | RLM:)
42 | LBM:{
43 | ID:x
44 | ASSIGN:=
45 | NUMBER:2
46 | SEMI:;
47 | ID:y
48 | ASSIGN:=
49 | NUMBER:3
50 | SEMI:;
51 | if:if
52 | LLM:(
53 | ID:x
54 | RT:>
55 | NUMBER:1
56 | RLM:)
57 | do:do
58 | ID:fact
59 | ASSIGN:=
60 | ID:fact
61 | MULTIPLY:*
62 | ID:x
63 | SEMI:;
64 | while:while
65 | LLM:(
66 | ID:fact
67 | RTEQ:>=
68 | NUMBER:1
69 | RLM:)
70 | SEMI:;
71 | else:else
72 | ID:x
73 | ASSIGN:=
74 | NUMBER:1
75 | SEMI:;
76 | return:return
77 | SEMI:;
78 | RBM:}
79 | EOF:EOF
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务2/2. 测试生成的程序/tree.out:
--------------------------------------------------------------------------------
1 | BTreeNode
2 | {
3 | kind: -1
4 | value: definition-list
5 | nodeList:
6 | BTreeNode
7 | {
8 | kind: -1
9 | value: definition-list
10 | nodeList:
11 | BTreeNode
12 | {
13 | kind: -1
14 | value: definition-list
15 | nodeList:
16 | BTreeNode
17 | {
18 | kind: -1
19 | value: definition-list
20 | nodeList:
21 | BTreeNode
22 | {
23 | kind: -1
24 | value: definition-list
25 | nodeList:
26 | BTreeNode
27 | {
28 | kind: ID
29 | value: x
30 | nodeList:
31 | BTreeNode
32 | {
33 | kind: int
34 | value: int
35 | }
36 | }
37 | BTreeNode
38 | {
39 | kind: ID
40 | value: fact
41 | nodeList:
42 | BTreeNode
43 | {
44 | kind: int
45 | value: int
46 | }
47 | }
48 | }
49 | BTreeNode
50 | {
51 | kind: ID
52 | value: y
53 | nodeList:
54 | BTreeNode
55 | {
56 | kind: double
57 | value: double
58 | }
59 | }
60 | }
61 | BTreeNode
62 | {
63 | kind: ID
64 | value: arr
65 | nodeList:
66 | BTreeNode
67 | {
68 | kind: int
69 | value: int
70 | }
71 | BTreeNode
72 | {
73 | kind: NUMBER
74 | value: 100
75 | }
76 | }
77 | }
78 | BTreeNode
79 | {
80 | kind: ID
81 | value: test
82 | nodeList:
83 | BTreeNode
84 | {
85 | kind: void
86 | value: void
87 | }
88 | BTreeNode
89 | {
90 | kind: -1
91 | value: parameter-list
92 | nodeList:
93 | BTreeNode
94 | {
95 | kind: ID
96 | value: a
97 | nodeList:
98 | BTreeNode
99 | {
100 | kind: int
101 | value: int
102 | }
103 | }
104 | BTreeNode
105 | {
106 | kind: ID
107 | value: b
108 | nodeList:
109 | BTreeNode
110 | {
111 | kind: int
112 | value: int
113 | }
114 | }
115 | }
116 | BTreeNode
117 | {
118 | kind: -2
119 | value: local-definitions
120 | nodeList:
121 | BTreeNode
122 | {
123 | kind: -1
124 | value: statement-list
125 | nodeList:
126 | BTreeNode
127 | {
128 | kind: -1
129 | value: statement-list
130 | nodeList:
131 | BTreeNode
132 | {
133 | kind: -1
134 | value: statement-list
135 | nodeList:
136 | BTreeNode
137 | {
138 | kind: -2
139 | value: statement-list
140 | }
141 | BTreeNode
142 | {
143 | kind: ASSIGN
144 | value: =
145 | nodeList:
146 | BTreeNode
147 | {
148 | kind: ID
149 | value: a
150 | }
151 | BTreeNode
152 | {
153 | kind: NUMBER
154 | value: 1
155 | }
156 | }
157 | }
158 | BTreeNode
159 | {
160 | kind: ASSIGN
161 | value: =
162 | nodeList:
163 | BTreeNode
164 | {
165 | kind: ID
166 | value: b
167 | }
168 | BTreeNode
169 | {
170 | kind: NUMBER
171 | value: 2
172 | }
173 | }
174 | }
175 | BTreeNode
176 | {
177 | kind: return
178 | value: return
179 | }
180 | }
181 | }
182 | }
183 | }
184 | BTreeNode
185 | {
186 | kind: ID
187 | value: main
188 | nodeList:
189 | BTreeNode
190 | {
191 | kind: void
192 | value: void
193 | }
194 | BTreeNode
195 | {
196 | kind: void
197 | value: void
198 | }
199 | BTreeNode
200 | {
201 | kind: -2
202 | value: local-definitions
203 | nodeList:
204 | BTreeNode
205 | {
206 | kind: -1
207 | value: statement-list
208 | nodeList:
209 | BTreeNode
210 | {
211 | kind: -1
212 | value: statement-list
213 | nodeList:
214 | BTreeNode
215 | {
216 | kind: -1
217 | value: statement-list
218 | nodeList:
219 | BTreeNode
220 | {
221 | kind: -1
222 | value: statement-list
223 | nodeList:
224 | BTreeNode
225 | {
226 | kind: -2
227 | value: statement-list
228 | }
229 | BTreeNode
230 | {
231 | kind: ASSIGN
232 | value: =
233 | nodeList:
234 | BTreeNode
235 | {
236 | kind: ID
237 | value: x
238 | }
239 | BTreeNode
240 | {
241 | kind: NUMBER
242 | value: 2
243 | }
244 | }
245 | }
246 | BTreeNode
247 | {
248 | kind: ASSIGN
249 | value: =
250 | nodeList:
251 | BTreeNode
252 | {
253 | kind: ID
254 | value: y
255 | }
256 | BTreeNode
257 | {
258 | kind: NUMBER
259 | value: 3
260 | }
261 | }
262 | }
263 | BTreeNode
264 | {
265 | kind: if
266 | value: if
267 | nodeList:
268 | BTreeNode
269 | {
270 | kind: RT
271 | value: >
272 | nodeList:
273 | BTreeNode
274 | {
275 | kind: ID
276 | value: x
277 | }
278 | BTreeNode
279 | {
280 | kind: NUMBER
281 | value: 1
282 | }
283 | }
284 | BTreeNode
285 | {
286 | kind: do
287 | value: do
288 | nodeList:
289 | BTreeNode
290 | {
291 | kind: ASSIGN
292 | value: =
293 | nodeList:
294 | BTreeNode
295 | {
296 | kind: ID
297 | value: fact
298 | }
299 | BTreeNode
300 | {
301 | kind: -1
302 | value: term
303 | nodeList:
304 | BTreeNode
305 | {
306 | kind: ID
307 | value: fact
308 | }
309 | BTreeNode
310 | {
311 | kind: MULTIPLY
312 | value: *
313 | }
314 | BTreeNode
315 | {
316 | kind: ID
317 | value: x
318 | }
319 | }
320 | }
321 | BTreeNode
322 | {
323 | kind: RTEQ
324 | value: >=
325 | nodeList:
326 | BTreeNode
327 | {
328 | kind: ID
329 | value: fact
330 | }
331 | BTreeNode
332 | {
333 | kind: NUMBER
334 | value: 1
335 | }
336 | }
337 | }
338 | BTreeNode
339 | {
340 | kind: ASSIGN
341 | value: =
342 | nodeList:
343 | BTreeNode
344 | {
345 | kind: ID
346 | value: x
347 | }
348 | BTreeNode
349 | {
350 | kind: NUMBER
351 | value: 1
352 | }
353 | }
354 | }
355 | }
356 | BTreeNode
357 | {
358 | kind: return
359 | value: return
360 | }
361 | }
362 | }
363 | }
364 | }
365 |
--------------------------------------------------------------------------------
/test/3. 任务三测试文本及程序/项目任务2/2. 测试生成的程序/treeCode.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/3. 任务三测试文本及程序/项目任务2/2. 测试生成的程序/treeCode.cpp
--------------------------------------------------------------------------------
/test/4. 测试报告/pdf版本/项目任务1:项目测试报告.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/4. 测试报告/pdf版本/项目任务1:项目测试报告.pdf
--------------------------------------------------------------------------------
/test/4. 测试报告/pdf版本/项目任务2:项目测试报告.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/4. 测试报告/pdf版本/项目任务2:项目测试报告.pdf
--------------------------------------------------------------------------------
/test/4. 测试报告/pdf版本/项目任务3:项目测试报告.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/4. 测试报告/pdf版本/项目任务3:项目测试报告.pdf
--------------------------------------------------------------------------------
/test/4. 测试报告/word版本/~$任务3:项目测试报告.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/4. 测试报告/word版本/~$任务3:项目测试报告.docx
--------------------------------------------------------------------------------
/test/4. 测试报告/word版本/项目任务1:项目测试报告.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/4. 测试报告/word版本/项目任务1:项目测试报告.docx
--------------------------------------------------------------------------------
/test/4. 测试报告/word版本/项目任务2:项目测试报告.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/4. 测试报告/word版本/项目任务2:项目测试报告.docx
--------------------------------------------------------------------------------
/test/4. 测试报告/word版本/项目任务3:项目测试报告.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/test/4. 测试报告/word版本/项目任务3:项目测试报告.docx
--------------------------------------------------------------------------------
/编译原理课程项目-讲稿.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/编译原理课程项目-讲稿.pdf
--------------------------------------------------------------------------------
/编译原理课程项目任务书.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TatttLeung/Compiler-Principles-Project/8b08b3248d034025889969da35721639b378b793/编译原理课程项目任务书.pdf
--------------------------------------------------------------------------------