一、实验要求: ............................................................................3
1.[实验项目]......................................................................................3
2.[设计说明]......................................................................................3
3.[设计要求]......................................................................................3
二、实验过程: ............................................................................4
1、程序功能描述.....................................................................................4
2、主要数据结构描述.............................................................................4
2.1 主要使用的 java 数据结构类型.................................................................4
2.1.1 List ....................................................................................................4
list 中是否包含某个元素..................................................................4
list 获取长度:..................................................................................4
list 中查看(判断)元素的索引......................................................5
根据元素索引位置进行的判断........................................................5
判断 list 是否为空.............................................................................6
2.1.2 Map ...................................................................................................6
HashMap ............................................................................................6
常用 API ............................................................................................6
Map 的遍历 .......................................................................................7
Map 获取元素 ...................................................................................7
2.2 二元式文件结构.........................................................................................8
1)FirstAndFollow 类:...................................................................................8
2)ProductionFormula 类: .............................................................................9
3)AssignmentGrammar 类: ..........................................................................9
4)StateDFA 类:...........................................................................................10
5)DFAManager 类: ....................................................................................11
状态图:..................................................................................................15
6)SLR1AnalysisTable 类: ..........................................................................15
7)AssignmentTranslationGrammar 类:......................................................17
8)SLR1Analyzer 类:...................................................................................17
9)TranslationMain 类:................................................................................19
3、程序结构描述...................................................................................19
1)FirstAndFollow 类中.................................................................................19
2)ProductionFormula 类: ...........................................................................20
3)AssignmentGrammar 类: .....................................................................20
4)StateDFA 类:...........................................................................................21
5)DFAMananger 类: ..................................................................................21
6)SLR1AnalysisTable 类: ..........................................................................22
7)AssignmentTranslationGrammar 类:.............................................22
8)SLR1Analyzer 类: ................................................................................23
9)TranslationMain 类:..........................................................................24
三、程序测试 ..............................................................................24