- 4
- 0
- 约6.58万字
- 约 17页
- 2017-06-05 发布于河南
- 举报
论文—简单优先文法(国外英文资料)
论文—简单优先文法(国外英文资料)
We use the three priority relationships to determine whether the symbol stack is moving in or out of the order of the current symbol, and if the first two are moved in, the third is a statute. In the process, we use a handle to search for the grammar that is used for the statute.
The leftmost direct phrase in a sentence is called the handle of the sentence pattern. A direct phrase and handle of a pattern can be described by the subtree of its syntax tree. Syntax tree of a simple child tree (only single subtree) strings of symbols of leaf node is the sentence patterns about the simple child of the root node a phrase directly. The symbolic string of the leaves of the simple subtree on the left of the syntax tree is the handle of this pattern. For example: for the grammar G [S] mentioned above, the substring (R) is the handle of the symbol string (R), a).
Third, program operation effect
To understand the programming ideas of the post, lets look at how the program works, as shown in figure 1.
Figure 1. The legal statement runs the result
Saw the above program is running as a result, I believe you already have a certain knowledge of simple priority analysis, lets to look at the simple precedence grammar analyzer design train of thought.
Fourth, design idea
(1) the definition of grammatical structure
The public struct MyData/grammar structure definition (to facilitate the analysis of the grammar into two parts)
{
Public string s1, s2; / / s1 is the non-terminal part of the grammar (before the equals sign), s2 is the second half
Public int s2_length; / / s2 length (easy to use)
}
Public int N = 50; / / the number of grammar bars that can be entered at most
Public MyData [] gam = new MyData [N]; / / keep all the grammar in the array
Public int num = 0; / / the number of grammar bars entered
(2) the preferential relation matrix
Analyzing the definition of a priority relationship is not difficult to get the following results:
The two linked characters are p
您可能关注的文档
最近下载
- 桥面系人行道施工方案.docx VIP
- 深川CHINSC S200系列通用矢量变频器说明书.pdf VIP
- (高清版)B-T 230.2-2022 金属材料 洛氏硬度试验 第2部分:硬度计及压头的检验与校准.pdf VIP
- 2024部编版初中历史八年纪上全册重点知识点归纳总结(复习必背).docx VIP
- 2025年招标师信息化与系统集成项目招标方案设计专题试卷及解析.pdf VIP
- 美妆直播间布置方案.docx VIP
- 2025年课件-(已瘦身)大学生创新创业基础(创新创业课程)PPT完整全套教学课件-新版.pptx
- 辽宁省建设工程系列专业技术资格评审标准.pdf VIP
- 2025年10月自考14444小学教师专业发展.试题及答案.pdf VIP
- 七下历史教学计划.docx VIP
原创力文档

文档评论(0)